From 7c0ba42c09e7e36e01f677fbfdbe116a676330b0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 Sep 2016 00:44:29 +0200 Subject: [PATCH] driver.c - Cleanups --- driver.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/driver.c b/driver.c index a2b0e2648d..7bf7f0e094 100644 --- a/driver.c +++ b/driver.c @@ -167,15 +167,16 @@ static bool driver_find_first(const char *label, char *s, size_t len) static bool driver_find_prev(const char *label, char *s, size_t len) { int i = driver_find_index(label, s); + if (i > 0) - find_driver_nonempty(label, i - 1, s, len); - else { - RARCH_WARN( - "Couldn't find any previous driver (current one: \"%s\").\n", s); - return false; + find_driver_nonempty(label, i - 1, s, len); + return true; } - return true; + + RARCH_WARN( + "Couldn't find any previous driver (current one: \"%s\").\n", s); + return false; } /** @@ -189,16 +190,17 @@ static bool driver_find_prev(const char *label, char *s, size_t len) bool driver_find_next(const char *label, char *s, size_t len) { int i = driver_find_index(label, s); + if (i >= 0 && !string_is_equal(s, "null")) - find_driver_nonempty(label, i + 1, s, len); - else { - RARCH_WARN("%s (current one: \"%s\").\n", - msg_hash_to_str(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER), - s); - return false; + find_driver_nonempty(label, i + 1, s, len); + return true; } - return true; + + RARCH_WARN("%s (current one: \"%s\").\n", + msg_hash_to_str(MSG_COULD_NOT_FIND_ANY_NEXT_DRIVER), + s); + return false; } static void driver_adjust_system_rates(void)