mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-28 17:41:38 +00:00
[SDL2] pointer boolean (#8523)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user