From 99e4682b4c4b7c2f3e06ea53e690ef7f1bba1250 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 27 Jul 2022 18:07:52 +0200 Subject: Minor code improvement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libgamepad_get_button_by_name.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'libgamepad_get_button_by_name.c') diff --git a/libgamepad_get_button_by_name.c b/libgamepad_get_button_by_name.c index 63af9d8..b44726c 100644 --- a/libgamepad_get_button_by_name.c +++ b/libgamepad_get_button_by_name.c @@ -37,12 +37,10 @@ libgamepad_get_button_by_name(const char *name) } errno = saved_errno; return (int16_t)code; - } else { - if (!strncasecmp(name, "KEY_#", 5) || !strncasecmp(name, "BTN_#", 5)) { - if (isdigit(name[5])) { - name = &name[5]; - goto numerical; - } + } else if (!strncasecmp(name, "KEY_#", 5) || !strncasecmp(name, "BTN_#", 5)) { + if (isdigit(name[5])) { + name = &name[5]; + goto numerical; } for (code = 0; code < ELEMSOF(libgamepad_button_names__); code++) if (!strcasecmp(name, libgamepad_button_names__[code])) @@ -52,6 +50,6 @@ libgamepad_get_button_by_name(const char *name) return (int16_t)NAME; LIST_ALIASES(X) #undef X - return -1; } + return -1; } -- cgit v1.2.3-70-g09d2