[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

@@ -49,7 +49,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
}
item = (SDL_joylist_item *)SDL_malloc(sizeof(SDL_joylist_item));
if (item == NULL) {
if (!item) {
return 1;
}
@@ -57,13 +57,13 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
item->index = gamepadEvent->index;
item->name = SDL_CreateJoystickName(0, 0, NULL, gamepadEvent->id);
if (item->name == NULL) {
if (!item->name) {
SDL_free(item);
return 1;
}
item->mapping = SDL_strdup(gamepadEvent->mapping);
if (item->mapping == NULL) {
if (!item->mapping) {
SDL_free(item->name);
SDL_free(item);
return 1;
@@ -84,7 +84,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
item->digitalButton[i] = gamepadEvent->digitalButton[i];
}
if (SDL_joylist_tail == NULL) {
if (!SDL_joylist_tail) {
SDL_joylist = SDL_joylist_tail = item;
} else {
SDL_joylist_tail->next = item;
@@ -111,7 +111,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
SDL_joylist_item *item = SDL_joylist;
SDL_joylist_item *prev = NULL;
while (item != NULL) {
while (item) {
if (item->index == gamepadEvent->index) {
break;
}
@@ -119,7 +119,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
item = item->next;
}
if (item == NULL) {
if (!item) {
return 1;
}
@@ -127,7 +127,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa
item->joystick->hwdata = NULL;
}
if (prev != NULL) {
if (prev) {
prev->next = item->next;
} else {
SDL_assert(SDL_joylist == item);
@@ -245,7 +245,7 @@ static SDL_joylist_item *JoystickByIndex(int index)
return NULL;
}
while (item != NULL) {
while (item) {
if (item->index == index) {
break;
}
@@ -297,11 +297,11 @@ static int EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
SDL_joylist_item *item = JoystickByDeviceIndex(device_index);
if (item == NULL) {
if (!item) {
return SDL_SetError("No such device");
}
if (item->joystick != NULL) {
if (item->joystick) {
return SDL_SetError("Joystick already opened");
}