From 91f61afa168a12d0f35aaf398acaa31a8e5fbb27 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 26 Dec 2015 07:07:01 +0100 Subject: [PATCH] Start using string_is_empty --- driver.c | 3 ++- retroarch.c | 19 ++++++++++++------- runloop.c | 7 ++++--- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/driver.c b/driver.c index 22c5cda839..31fa110f2d 100644 --- a/driver.c +++ b/driver.c @@ -15,6 +15,7 @@ */ #include +#include #include "general.h" #include "msg_hash.h" @@ -139,7 +140,7 @@ int find_driver_index(const char * label, const char *drv) { if (!obj) return -1; - if (str[0] == '\0') + if (string_is_empty(str)) break; if (!strcasecmp(drv, str)) return i; diff --git a/retroarch.c b/retroarch.c index 4e9dbaa8da..cba4fe3431 100644 --- a/retroarch.c +++ b/retroarch.c @@ -24,6 +24,7 @@ #include #include +#include #ifdef _WIN32 #ifdef _XBOX @@ -333,7 +334,7 @@ static void set_special_paths(char **argv, unsigned num_content) /* If this is already set, * do not overwrite it as this was initialized before in * a menu or otherwise. */ - if (settings->system_directory[0] == '\0') + if (string_is_empty(settings->system_directory)) { RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",argv[0]); /*fill_pathname_basedir(settings->system_directory, argv[0], @@ -365,7 +366,7 @@ static void set_paths_redirect(const char *path) return; } if (info->info.library_name && - (info->info.library_name[0] != '\0')) + !string_is_empty(info->info.library_name)) global_library_name_hash = msg_hash_calculate(info->info.library_name); /* Initialize current save directories with the values from the config */ @@ -385,7 +386,8 @@ static void set_paths_redirect(const char *path) if (check_global_library_name_hash) { /* per-core saves: append the library_name to the save location */ - if (settings->sort_savefiles_enable && global->dir.savefile[0] != '\0') + if (settings->sort_savefiles_enable + && !string_is_empty(global->dir.savefile)) { fill_pathname_join( current_savefile_dir, @@ -395,7 +397,8 @@ static void set_paths_redirect(const char *path) /* If path doesn't exist, try to create it, * if everything fails revert to the original path. */ - if(!path_is_directory(current_savefile_dir) && current_savefile_dir[0] != '\0') + if(!path_is_directory(current_savefile_dir) + && !string_is_empty(current_savefile_dir)) { path_mkdir(current_savefile_dir); if(!path_is_directory(current_savefile_dir)) @@ -409,7 +412,8 @@ static void set_paths_redirect(const char *path) } /* per-core states: append the library_name to the save location */ - if (settings->sort_savestates_enable && global->dir.savestate[0] != '\0') + if (settings->sort_savestates_enable + && !string_is_empty(global->dir.savestate)) { fill_pathname_join( current_savestate_dir, @@ -419,7 +423,8 @@ static void set_paths_redirect(const char *path) /* If path doesn't exist, try to create it. * If everything fails, revert to the original path. */ - if(!path_is_directory(current_savestate_dir) && current_savestate_dir[0] != '\0') + if(!path_is_directory(current_savestate_dir) && + !string_is_empty(current_savestate_dir)) { path_mkdir(current_savestate_dir); if(!path_is_directory(current_savestate_dir)) @@ -1539,7 +1544,7 @@ void rarch_playlist_load_content(void *data, unsigned idx) content_playlist_get_index(playlist, idx, &path, NULL, &core_path, NULL, NULL, NULL); - if (path && path[0] != '\0') + if (path && !string_is_empty(path)) { unsigned i; RFILE *fp = NULL; diff --git a/runloop.c b/runloop.c index eead3d0dd2..d29e831508 100644 --- a/runloop.c +++ b/runloop.c @@ -26,6 +26,7 @@ #ifdef HAVE_THREADS #include #endif +#include #include @@ -420,7 +421,7 @@ static bool rarch_game_specific_options(char **output) if (!core_name || !game_name) return false; - if (core_name[0] == '\0' || game_name[0] == '\0') + if (string_is_empty(core_name) || string_is_empty(game_name)) return false; RARCH_LOG("Per-Game Options: core name: %s\n", core_name); @@ -429,9 +430,9 @@ static bool rarch_game_specific_options(char **output) /* Config directory: config_directory. * Try config directory setting first, * fallback to the location of the current configuration file. */ - if (settings->menu_config_directory[0] != '\0') + if (!string_is_empty(settings->menu_config_directory)) strlcpy(config_directory, settings->menu_config_directory, sizeof(config_directory)); - else if (global->path.config[0] != '\0') + else if (!string_is_empty(global->path.config)) fill_pathname_basedir(config_directory, global->path.config, sizeof(config_directory)); else {