Use new parameter validation macro

This commit is contained in:
Sam Lantinga
2025-09-16 21:51:03 -07:00
parent ee1c90a358
commit 25b2d2c821
60 changed files with 1113 additions and 1133 deletions

View File

@@ -222,7 +222,7 @@ char **SDL_GetEnvironmentVariables(SDL_Environment *env)
{
char **result = NULL;
if (!env) {
CHECK_PARAM(!env) {
SDL_InvalidParamError("env");
return NULL;
}
@@ -253,11 +253,13 @@ bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const ch
{
bool result = false;
if (!env) {
CHECK_PARAM(!env) {
return SDL_InvalidParamError("env");
} else if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
}
CHECK_PARAM(!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
return SDL_InvalidParamError("name");
} else if (!value) {
}
CHECK_PARAM(!value) {
return SDL_InvalidParamError("value");
}
@@ -292,9 +294,10 @@ bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
{
bool result = false;
if (!env) {
CHECK_PARAM(!env) {
return SDL_InvalidParamError("env");
} else if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
}
CHECK_PARAM(!name || *name == '\0' || SDL_strchr(name, '=') != NULL) {
return SDL_InvalidParamError("name");
}

View File

@@ -6419,16 +6419,16 @@ bool SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func)
{
if (!malloc_func) {
CHECK_PARAM(!malloc_func) {
return SDL_InvalidParamError("malloc_func");
}
if (!calloc_func) {
CHECK_PARAM(!calloc_func) {
return SDL_InvalidParamError("calloc_func");
}
if (!realloc_func) {
CHECK_PARAM(!realloc_func) {
return SDL_InvalidParamError("realloc_func");
}
if (!free_func) {
CHECK_PARAM(!free_func) {
return SDL_InvalidParamError("free_func");
}