[SDL2] pointer boolean (#8523)

This commit is contained in:
Sylvain Becker
2023-11-10 15:30:56 +01:00
committed by GitHub
parent 4a3a9f3ad8
commit a14b948b6c
394 changed files with 2564 additions and 2559 deletions

View File

@@ -48,7 +48,7 @@ void *SDL_LoadObject(const char *sofile)
handle = dlopen(sofile, RTLD_NOW | RTLD_LOCAL);
loaderror = dlerror();
if (handle == NULL) {
if (!handle) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
}
return handle;
@@ -57,7 +57,7 @@ void *SDL_LoadObject(const char *sofile)
void *SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = dlsym(handle, name);
if (symbol == NULL) {
if (!symbol) {
/* prepend an underscore for platforms that need that. */
SDL_bool isstack;
size_t len = SDL_strlen(name) + 1;
@@ -66,7 +66,7 @@ void *SDL_LoadFunction(void *handle, const char *name)
SDL_memcpy(&_name[1], name, len);
symbol = dlsym(handle, _name);
SDL_small_free(_name, isstack);
if (symbol == NULL) {
if (!symbol) {
SDL_SetError("Failed loading %s: %s", name,
(const char *)dlerror());
}
@@ -76,7 +76,7 @@ void *SDL_LoadFunction(void *handle, const char *name)
void SDL_UnloadObject(void *handle)
{
if (handle != NULL) {
if (handle) {
dlclose(handle);
}
}

View File

@@ -90,7 +90,7 @@ void *SDL_LoadFunction(void *handle, const char *name)
void SDL_UnloadObject(void *handle)
{
if (handle != NULL) {
if (handle) {
DosFreeModule((HMODULE)handle);
}
}

View File

@@ -34,7 +34,7 @@ void *SDL_LoadObject(const char *sofile)
void *handle;
LPTSTR tstr;
if (sofile == NULL) {
if (!sofile) {
SDL_InvalidParamError("sofile");
return NULL;
}
@@ -51,7 +51,7 @@ void *SDL_LoadObject(const char *sofile)
SDL_free(tstr);
/* Generate an error message if all loads failed */
if (handle == NULL) {
if (!handle) {
char errbuf[512];
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf));
@@ -63,7 +63,7 @@ void *SDL_LoadObject(const char *sofile)
void *SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = (void *)GetProcAddress((HMODULE)handle, name);
if (symbol == NULL) {
if (!symbol) {
char errbuf[512];
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
SDL_strlcat(errbuf, name, SDL_arraysize(errbuf));
@@ -74,7 +74,7 @@ void *SDL_LoadFunction(void *handle, const char *name)
void SDL_UnloadObject(void *handle)
{
if (handle != NULL) {
if (handle) {
FreeLibrary((HMODULE)handle);
}
}