Removed SDL_bool in favor of plain bool

We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
This commit is contained in:
Sam Lantinga 2024-09-18 07:52:28 -07:00
parent 9dd8859240
commit a90ad3b0e2
258 changed files with 4052 additions and 4057 deletions

View file

@ -76,7 +76,7 @@ static void SDL_InitDynamicAPI(void);
}
#define SDL_DYNAPI_VARARGS(_static, name, initcall) \
_static SDL_bool SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
_static bool SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
{ \
char buf[128], *str = buf; \
int result; \
@ -100,7 +100,7 @@ static void SDL_InitDynamicAPI(void);
if (str != buf) { \
jump_table.SDL_free(str); \
} \
return SDL_FALSE; \
return false; \
} \
_static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) \
{ \
@ -233,7 +233,7 @@ SDL_DYNAPI_VARARGS(, , )
#define ENABLE_SDL_CALL_LOGGING 0
#if ENABLE_SDL_CALL_LOGGING
static SDL_bool SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
static bool SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
char buf[512]; // !!! FIXME: dynamic allocation
va_list ap;
@ -354,7 +354,7 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
#if ENABLE_SDL_CALL_LOGGING
{
const char *env = SDL_getenv_unsafe_REAL("SDL_DYNAPI_LOG_CALLS");
const SDL_bool log_calls = (env && SDL_atoi_REAL(env));
const bool log_calls = (env && SDL_atoi_REAL(env));
if (log_calls) {
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) jump_table.fn = fn##_LOGSDLCALLS;
#include "SDL_dynapi_procs.h"
@ -465,13 +465,13 @@ static void SDL_InitDynamicAPILocked(void)
{
const char *libname = SDL_getenv_unsafe_REAL(SDL_DYNAMIC_API_ENVVAR);
SDL_DYNAPI_ENTRYFN entry = NULL; // funcs from here by default.
SDL_bool use_internal = SDL_TRUE;
bool use_internal = true;
if (libname) {
while (*libname && !entry) {
// This is evil, but we're not making any permanent changes...
char *ptr = (char *)libname;
while (SDL_TRUE) {
while (true) {
char ch = *ptr;
if ((ch == ',') || (ch == '\0')) {
*ptr = '\0';
@ -495,7 +495,7 @@ static void SDL_InitDynamicAPILocked(void)
dynapi_warn("Couldn't override SDL library. Using a newer SDL build might help. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL.");
// Just fill in the function pointers from this library, later.
} else {
use_internal = SDL_FALSE; // We overrode SDL! Don't use the internal version!
use_internal = false; // We overrode SDL! Don't use the internal version!
}
}
@ -524,14 +524,14 @@ static void SDL_InitDynamicAPI(void)
* SDL_CreateThread() would also call this function before building the
* new thread).
*/
static SDL_bool already_initialized = SDL_FALSE;
static bool already_initialized = false;
static SDL_SpinLock lock = 0;
SDL_LockSpinlock_REAL(&lock);
if (!already_initialized) {
SDL_InitDynamicAPILocked();
already_initialized = SDL_TRUE;
already_initialized = true;
}
SDL_UnlockSpinlock_REAL(&lock);