mirror of
https://github.com/libretro/RetroArch
synced 2025-03-05 19:13:45 +00:00
Cleanups
This commit is contained in:
parent
6bb5af8ee0
commit
8238545bef
@ -46,8 +46,7 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
if (!conf || string_is_empty(path))
|
||||
return false;
|
||||
|
||||
if (global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
if (!string_is_empty(global->name.remapfile))
|
||||
free(global->name.remapfile);
|
||||
global->name.remapfile = strdup(path);
|
||||
|
||||
@ -259,8 +258,7 @@ void input_remapping_set_defaults(bool deinit)
|
||||
|
||||
if (deinit)
|
||||
{
|
||||
if (global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
if (!string_is_empty(global->name.remapfile))
|
||||
free(global->name.remapfile);
|
||||
global->name.remapfile = NULL;
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
|
||||
|
@ -896,7 +896,7 @@ bool config_file_write(config_file_t *conf, const char *path)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
if (path && !string_is_empty(path))
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
file = fopen(path, "w");
|
||||
if (!file)
|
||||
|
@ -206,7 +206,7 @@ void libretrodb_close(libretrodb_t *db)
|
||||
{
|
||||
if (db->fd)
|
||||
filestream_close(db->fd);
|
||||
if (db->path && !string_is_empty(db->path))
|
||||
if (!string_is_empty(db->path))
|
||||
free(db->path);
|
||||
db->path = NULL;
|
||||
db->fd = NULL;
|
||||
@ -222,7 +222,7 @@ int libretrodb_open(const char *path, libretrodb_t *db)
|
||||
if (!fd)
|
||||
return -errno;
|
||||
|
||||
if (db->path && !string_is_empty(db->path))
|
||||
if (!string_is_empty(db->path))
|
||||
free(db->path);
|
||||
|
||||
db->path = strdup(path);
|
||||
@ -428,7 +428,7 @@ void libretrodb_cursor_close(libretrodb_cursor_t *cursor)
|
||||
int libretrodb_cursor_open(libretrodb_t *db, libretrodb_cursor_t *cursor,
|
||||
libretrodb_query_t *q)
|
||||
{
|
||||
if (!db || !db->path || string_is_empty(db->path))
|
||||
if (!db || string_is_empty(db->path))
|
||||
return -errno;
|
||||
|
||||
cursor->fd = filestream_open(db->path, RFILE_MODE_READ | RFILE_HINT_MMAP, -1);
|
||||
|
@ -282,9 +282,9 @@ static int deferred_push_core_collection_list_deferred(
|
||||
static int deferred_push_database_manager_list_deferred(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
if (info->path_b && !string_is_empty(info->path_b))
|
||||
if (!string_is_empty(info->path_b))
|
||||
free(info->path_b);
|
||||
if (info->path_c && !string_is_empty(info->path_c))
|
||||
if (!string_is_empty(info->path_c))
|
||||
free(info->path_c);
|
||||
|
||||
info->path_b = strdup(info->path);
|
||||
@ -464,11 +464,11 @@ static int deferred_push_cursor_manager_list_deferred(
|
||||
settings->paths.path_content_database,
|
||||
rdb, sizeof(rdb_path));
|
||||
|
||||
if (info->path_b && !string_is_empty(info->path_b))
|
||||
if (!string_is_empty(info->path_b))
|
||||
free(info->path_b);
|
||||
if (info->path_c && !string_is_empty(info->path_c))
|
||||
if (!string_is_empty(info->path_c))
|
||||
free(info->path_c);
|
||||
if (info->path && !string_is_empty(info->path))
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
|
||||
info->path_b = strdup(info->path);
|
||||
@ -505,11 +505,11 @@ static int deferred_push_cursor_manager_list_generic(
|
||||
if (string_is_empty(query))
|
||||
goto end;
|
||||
|
||||
if (info->path_b && !string_is_empty(info->path_b))
|
||||
if (!string_is_empty(info->path_b))
|
||||
free(info->path_b);
|
||||
if (info->path_c && !string_is_empty(info->path_c))
|
||||
if (!string_is_empty(info->path_c))
|
||||
free(info->path_c);
|
||||
if (info->path && !string_is_empty(info->path))
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
|
||||
info->path = strdup(str_list->elems[1].data);
|
||||
@ -637,11 +637,11 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch(
|
||||
if (string_is_empty(query))
|
||||
goto end;
|
||||
|
||||
if (info->path && !string_is_empty(info->path))
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
if (info->path_b && !string_is_empty(info->path_b))
|
||||
if (!string_is_empty(info->path_b))
|
||||
free(info->path_b);
|
||||
if (info->path_c && !string_is_empty(info->path_c))
|
||||
if (!string_is_empty(info->path_c))
|
||||
free(info->path_c);
|
||||
info->path = strdup(str_list->elems[1].data);
|
||||
info->path_b = strdup(str_list->elems[0].data);
|
||||
@ -689,9 +689,9 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
fill_pathname_join(tmp_str2, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(tmp_str2));
|
||||
|
||||
if (info->path && !string_is_empty(info->path))
|
||||
if (!string_is_empty(info->path))
|
||||
free(info->path);
|
||||
if (info->label && !string_is_empty(info->label))
|
||||
if (!string_is_empty(info->label))
|
||||
free(info->label);
|
||||
|
||||
info->path = strdup(tmp_str);
|
||||
@ -761,7 +761,7 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
if (!new_exts)
|
||||
new_exts = info->exts;
|
||||
|
||||
if (new_exts && !string_is_empty(new_exts))
|
||||
if (!string_is_empty(new_exts))
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
@ -886,7 +886,7 @@ static int general_push(menu_displaylist_info_t *info,
|
||||
|
||||
if (!string_is_empty(newstring2))
|
||||
{
|
||||
if (info->exts && !string_is_empty(info->exts))
|
||||
if (!string_is_empty(info->exts))
|
||||
free(info->exts);
|
||||
info->exts = strdup(newstring2);
|
||||
}
|
||||
|
@ -107,8 +107,7 @@ static void menu_action_setting_disp_set_label_remap_file_load(
|
||||
|
||||
*w = 19;
|
||||
strlcpy(s2, path, len2);
|
||||
if (global && global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
if (global && !string_is_empty(global->name.remapfile))
|
||||
fill_pathname_base(s, global->name.remapfile,
|
||||
len);
|
||||
}
|
||||
@ -622,7 +621,7 @@ static void menu_action_setting_disp_set_label_menu_more(
|
||||
{
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len);
|
||||
*w = 19;
|
||||
if (path && !string_is_empty(path))
|
||||
if (!string_is_empty(path))
|
||||
strlcpy(s2, path, len2);
|
||||
}
|
||||
|
||||
@ -637,7 +636,7 @@ static void menu_action_setting_disp_set_label_db_entry(
|
||||
{
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len);
|
||||
*w = 10;
|
||||
if (path && !string_is_empty(path))
|
||||
if (!string_is_empty(path))
|
||||
strlcpy(s2, path, len2);
|
||||
}
|
||||
|
||||
|
@ -1384,16 +1384,16 @@ static int action_ok_file_load(const char *path,
|
||||
|
||||
file_list_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL);
|
||||
|
||||
if (menu_label && !string_is_empty(menu_label))
|
||||
if (!string_is_empty(menu_label))
|
||||
setting = menu_setting_find(menu_label);
|
||||
|
||||
if (setting_get_type(setting) == ST_PATH)
|
||||
return action_ok_set_path(path, label, type, idx, entry_idx);
|
||||
|
||||
if (menu_path && !string_is_empty(menu_path))
|
||||
if (!string_is_empty(menu_path))
|
||||
strlcpy(menu_path_new, menu_path, sizeof(menu_path_new));
|
||||
|
||||
if (menu_label && !string_is_empty(menu_label))
|
||||
if (!string_is_empty(menu_label))
|
||||
{
|
||||
if (
|
||||
string_is_equal(menu_label,
|
||||
@ -2424,7 +2424,7 @@ static int action_ok_file_load_ffmpeg(const char *path,
|
||||
content_info.args = NULL;
|
||||
content_info.environ_get = NULL;
|
||||
|
||||
if (menu_path && !string_is_empty(menu_path))
|
||||
if (!string_is_empty(menu_path))
|
||||
fill_pathname_join(new_path, menu_path, path,
|
||||
sizeof(new_path));
|
||||
|
||||
@ -2486,7 +2486,7 @@ static int action_ok_file_load_imageviewer(const char *path,
|
||||
content_info.args = NULL;
|
||||
content_info.environ_get = NULL;
|
||||
|
||||
if (menu_path && !string_is_empty(menu_path))
|
||||
if (!string_is_empty(menu_path))
|
||||
fill_pathname_join(fullpath, menu_path, path,
|
||||
sizeof(fullpath));
|
||||
|
||||
@ -3645,9 +3645,7 @@ static void netplay_refresh_rooms_cb(void *task_data, void *user_data, const cha
|
||||
if (!strstr(data->data, file_path_str(FILE_PATH_NETPLAY_ROOM_LIST_URL)))
|
||||
{
|
||||
if (string_is_empty(data->data))
|
||||
{
|
||||
netplay_room_count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char s[PATH_MAX_LENGTH];
|
||||
|
@ -41,7 +41,7 @@ static void sanitize_to_string(char *s, const char *label, size_t len)
|
||||
|
||||
new_label[0] = '\0';
|
||||
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
strlcpy(new_label, label, sizeof(new_label));
|
||||
if (s && !string_is_empty(new_label))
|
||||
{
|
||||
@ -52,9 +52,7 @@ static void sanitize_to_string(char *s, const char *label, size_t len)
|
||||
|
||||
static int fill_title(char *s, const char *title, const char *path, size_t len)
|
||||
{
|
||||
if ( (path && !string_is_empty(path))
|
||||
&&
|
||||
(title && !string_is_empty(title)))
|
||||
if (!string_is_empty(path) && !string_is_empty(title))
|
||||
fill_pathname_join_delim(s, title, path, ' ', len);
|
||||
return 0;
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ static void xui_render(void *data, bool is_idle)
|
||||
xui_set_list_text(i, msg_left, msg_right);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
if (entry_path && !string_is_empty(entry_path))
|
||||
if (!string_is_empty(entry_path))
|
||||
free(entry_path);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ static int zarch_zui_render_lay_root_recent(
|
||||
if (menu_entry_action(&entry, i, MENU_ACTION_OK))
|
||||
{
|
||||
menu_entry_free(&entry);
|
||||
if (rich_label && !string_is_empty(rich_label))
|
||||
if (!string_is_empty(rich_label))
|
||||
free(rich_label);
|
||||
return 1;
|
||||
}
|
||||
@ -542,7 +542,7 @@ static int zarch_zui_render_lay_root_recent(
|
||||
|
||||
j++;
|
||||
menu_entry_free(&entry);
|
||||
if (rich_label && !string_is_empty(rich_label))
|
||||
if (!string_is_empty(rich_label))
|
||||
free(rich_label);
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
if (!string_is_empty(newpath))
|
||||
entry->path = strdup(newpath);
|
||||
|
||||
if (entry_label && !string_is_empty(entry_label))
|
||||
if (!string_is_empty(entry_label))
|
||||
entry->label = strdup(entry_label);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void filebrowser_parse(void *data, unsigned type_data)
|
||||
enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state)
|
||||
type_data;
|
||||
const char *path = info ? info->path : NULL;
|
||||
bool path_is_compressed = (path && !string_is_empty(path))
|
||||
bool path_is_compressed = !string_is_empty(path)
|
||||
? path_is_compressed_file(path) : false;
|
||||
bool filter_ext =
|
||||
settings->bools.menu_navigation_browser_filter_supported_extensions_enable;
|
||||
|
3
paths.c
3
paths.c
@ -72,8 +72,7 @@ void path_set_redirect(void)
|
||||
|
||||
new_savefile_dir[0] = new_savestate_dir[0] = '\0';
|
||||
|
||||
if (info && info->info.library_name &&
|
||||
!string_is_empty(info->info.library_name))
|
||||
if (info && !string_is_empty(info->info.library_name))
|
||||
library_name_hash =
|
||||
msg_hash_calculate(info->info.library_name);
|
||||
|
||||
|
@ -325,8 +325,7 @@ static void global_free(void)
|
||||
dir_clear_all();
|
||||
if (global)
|
||||
{
|
||||
if (global->name.remapfile
|
||||
&& !string_is_empty(global->name.remapfile))
|
||||
if (!string_is_empty(global->name.remapfile))
|
||||
free(global->name.remapfile);
|
||||
}
|
||||
memset(global, 0, sizeof(struct global));
|
||||
|
@ -133,12 +133,12 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
|
||||
sizeof(buffer));
|
||||
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
result.textLabel.text = BOXSTRING(label);
|
||||
result.detailTextLabel.text = BOXSTRING(buffer);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
free(label);
|
||||
|
||||
return result;
|
||||
@ -177,7 +177,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
|
||||
label = menu_entry_get_path(&entry);
|
||||
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
result.textLabel.text = BOXSTRING(label);
|
||||
|
||||
[(id)result.accessoryView removeTarget:nil
|
||||
@ -188,7 +188,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
[(id)result.accessoryView setOn:(menu_entry_get_bool_value(self.i))];
|
||||
menu_entry_free(&entry);
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
free(label);
|
||||
return result;
|
||||
}
|
||||
@ -234,7 +234,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
label = menu_entry_get_path(&entry);
|
||||
items = menu_entry_enum_values(self.i);
|
||||
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
{
|
||||
RunActionSheet(label, items, self.parentTable,
|
||||
^(UIActionSheet* actionSheet, NSInteger buttonIndex)
|
||||
@ -249,7 +249,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
}
|
||||
string_list_free(items);
|
||||
menu_entry_free(&entry);
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
free(label);
|
||||
}
|
||||
@end
|
||||
@ -291,7 +291,7 @@ static void RunActionSheet(const char* title, const struct string_list* items,
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
menu_entry_free(&entry);
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
free(label);
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ replacementString:(NSString *)string
|
||||
|
||||
menu_entry_free(&entry);
|
||||
|
||||
if (label && !string_is_empty(label))
|
||||
if (!string_is_empty(label))
|
||||
free(label);
|
||||
|
||||
[alertView show];
|
||||
|
@ -30,7 +30,7 @@ static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
|
||||
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
|
||||
NSArray *filetypes = NULL;
|
||||
|
||||
if (state->filters && !string_is_empty(state->filters))
|
||||
if (!string_is_empty(state->filters))
|
||||
filetypes = [[NSArray alloc] initWithObjects:BOXSTRING(state->filters), BOXSTRING(state->filters_title), nil];
|
||||
[panel setAllowedFileTypes:filetypes];
|
||||
#if defined(MAC_OS_X_VERSION_10_6)
|
||||
|
Loading…
x
Reference in New Issue
Block a user