From 23eb3fa2ad24f8e414b5f93b02a57a6e86e22bfa Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 Mar 2015 04:22:41 +0100 Subject: [PATCH] Add returntype to find_next_driver/find_prev_driver --- driver.c | 12 ++++++++++-- driver.h | 8 ++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/driver.c b/driver.c index eb39f227b4..ab06831c6c 100644 --- a/driver.c +++ b/driver.c @@ -142,14 +142,18 @@ int find_driver_index(const char * label, const char *drv) * * Find previous driver in driver array. **/ -void find_prev_driver(const char *label, char *str, size_t sizeof_str) +bool find_prev_driver(const char *label, char *str, size_t sizeof_str) { int i = find_driver_index(label, str); if (i > 0) find_driver_nonempty(label, i - 1, str, sizeof_str); else + { RARCH_WARN( "Couldn't find any previous driver (current one: \"%s\").\n", str); + return false; + } + return true; } /** @@ -160,13 +164,17 @@ void find_prev_driver(const char *label, char *str, size_t sizeof_str) * * Find next driver in driver array. **/ -void find_next_driver(const char *label, char *str, size_t sizeof_str) +bool find_next_driver(const char *label, char *str, size_t sizeof_str) { int i = find_driver_index(label, str); if (i >= 0) find_driver_nonempty(label, i + 1, str, sizeof_str); else + { RARCH_WARN("Couldn't find any next driver (current one: \"%s\").\n", str); + return false; + } + return true; } /** diff --git a/driver.h b/driver.h index 6fd71662ce..e2ef62040d 100644 --- a/driver.h +++ b/driver.h @@ -329,8 +329,10 @@ void uninit_drivers(int flags); * @sizeof_str : size of @str. * * Find previous driver in driver array. + * + * Returns: true (1) if successful, otherwise false (0). **/ -void find_prev_driver(const char *label, char *str, size_t sizeof_str); +bool find_prev_driver(const char *label, char *str, size_t sizeof_str); /** * find_next_driver: @@ -339,8 +341,10 @@ void find_prev_driver(const char *label, char *str, size_t sizeof_str); * @sizeof_str : size of @str. * * Find next driver in driver array. + * + * Returns: true (1) if successful, otherwise false (0). **/ -void find_next_driver(const char *label, char *str, size_t sizeof_str); +bool find_next_driver(const char *label, char *str, size_t sizeof_str); /** * driver_set_nonblock_state: