| From fb0ce375f0474501764a4bce7b609a1eab143526 Mon Sep 17 00:00:00 2001 |
| From: Sylvain Becker <sylvain.becker@gmail.com> |
| Date: Sun, 27 Nov 2022 17:38:43 +0100 |
| Subject: [PATCH 1/5] 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 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3) |
| |
| src/core/linux/SDL_evdev_kbd.c | 64 +++++++++++++++++++++------------- |
| 1 file changed, 39 insertions(+), 25 deletions(-) |
| |
| diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c |
| index f090bff41..f7f01deb4 100644 |
| |
| |
| @@ -270,13 +270,14 @@ static void kbd_unregister_emerg_cleanup() |
| old_action_p = &(old_sigaction[signum]); |
| |
| /* Examine current signal action */ |
| - if (sigaction(signum, NULL, &cur_action)) |
| + if (sigaction(signum, NULL, &cur_action)) { |
| continue; |
| + } |
| |
| /* Check if action installed and not modifed */ |
| - if (!(cur_action.sa_flags & SA_SIGINFO) |
| - || cur_action.sa_sigaction != &kbd_cleanup_signal_action) |
| + if (!(cur_action.sa_flags & SA_SIGINFO) || cur_action.sa_sigaction != &kbd_cleanup_signal_action) { |
| continue; |
| + } |
| |
| /* Restore original action */ |
| sigaction(signum, old_action_p, NULL); |
| @@ -320,16 +321,16 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state * kbd) |
| struct sigaction new_action; |
| signum = fatal_signals[tabidx]; |
| old_action_p = &(old_sigaction[signum]); |
| - if (sigaction(signum, NULL, old_action_p)) |
| + if (sigaction(signum, NULL, old_action_p)) { |
| continue; |
| + } |
| |
| /* Skip SIGHUP and SIGPIPE if handler is already installed |
| * - assume the handler will do the cleanup |
| */ |
| - if ((signum == SIGHUP || signum == SIGPIPE) |
| - && (old_action_p->sa_handler != SIG_DFL |
| - || (void (*)(int))old_action_p->sa_sigaction != SIG_DFL)) |
| + if ((signum == SIGHUP || signum == SIGPIPE) && (old_action_p->sa_handler != SIG_DFL || (void(*)(int))old_action_p->sa_sigaction != SIG_DFL)) { |
| continue; |
| + } |
| |
| new_action = *old_action_p; |
| new_action.sa_flags |= SA_SIGINFO; |
| @@ -347,7 +348,7 @@ SDL_EVDEV_kbd_init(void) |
| char shift_state[ sizeof (long) ] = {TIOCL_GETSHIFTSTATE, 0}; |
| |
| kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); |
| - if (!kbd) { |
| + if (kbd == NULL) { |
| return NULL; |
| } |
| |
| @@ -413,7 +414,7 @@ SDL_EVDEV_kbd_init(void) |
| void |
| SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) |
| { |
| - if (!kbd) { |
| + if (kbd == NULL) { |
| return; |
| } |
| |
| @@ -461,10 +462,12 @@ static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) |
| put_queue(kbd, 0xc0 | (c >> 6)); |
| put_queue(kbd, 0x80 | (c & 0x3f)); |
| } else if (c < 0x10000) { |
| - if (c >= 0xD800 && c < 0xE000) |
| + if (c >= 0xD800 && c < 0xE000) { |
| return; |
| - if (c == 0xFFFF) |
| + } |
| + if (c == 0xFFFF) { |
| return; |
| + } |
| /* 1110**** 10 |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |