mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-23 15:56:00 +00:00
Cleanup add brace (#6545)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
(cherry picked from commit 6a2200823c to reduce conflicts merging between SDL2 and SDL3)
This commit is contained in:
committed by
Sam Lantinga
parent
0739d237ad
commit
fb0ce375f0
@@ -98,7 +98,7 @@ static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_IN
|
||||
|
||||
static void UpdateWindowTitle()
|
||||
{
|
||||
if (!window) {
|
||||
if (window == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,13 +190,13 @@ static void AddController(int device_index, SDL_bool verbose)
|
||||
}
|
||||
|
||||
controller = SDL_GameControllerOpen(device_index);
|
||||
if (!controller) {
|
||||
if (controller == NULL) {
|
||||
SDL_Log("Couldn't open controller: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
controllers = (SDL_GameController **)SDL_realloc(gamecontrollers, (num_controllers + 1) * sizeof(*controllers));
|
||||
if (!controllers) {
|
||||
if (controllers == NULL) {
|
||||
SDL_GameControllerClose(controller);
|
||||
return;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ static void OpenVirtualController()
|
||||
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
|
||||
} else {
|
||||
virtual_joystick = SDL_JoystickOpen(virtual_index);
|
||||
if (!virtual_joystick) {
|
||||
if (virtual_joystick == NULL) {
|
||||
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
|
||||
}
|
||||
}
|
||||
@@ -912,7 +912,7 @@ main(int argc, char *argv[])
|
||||
button_texture = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL);
|
||||
axis_texture = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL);
|
||||
|
||||
if (!background_front || !background_back || !button_texture || !axis_texture) {
|
||||
if (background_front == NULL || background_back == NULL || button_texture == NULL || axis_texture == NULL) {
|
||||
SDL_DestroyRenderer(screen);
|
||||
SDL_DestroyWindow(window);
|
||||
return 2;
|
||||
|
||||
Reference in New Issue
Block a user