From e4208750c8a4adf242cca7e9238834042802d7b7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 15 Dec 2016 12:18:26 +0100 Subject: [PATCH] (menu_content.c) Cleanups --- menu/cbs/menu_cbs_ok.c | 9 ++++++++ menu/menu_content.c | 48 ++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index b543712059..d3dc17ffc7 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1087,7 +1087,10 @@ static int action_ok_playlist_entry_collection(const char *path, playlist_info.idx = selection_ptr; if (!menu_content_playlist_load(&playlist_info)) + { + runloop_msg_queue_push("File could not be loaded from playlist.\n", 1, 100, true); return menu_cbs_exit(); + } playlist_get_index(playlist, playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); @@ -1171,7 +1174,10 @@ static int action_ok_playlist_entry(const char *path, playlist_info.idx = selection_ptr; if (!menu_content_playlist_load(&playlist_info)) + { + runloop_msg_queue_push("File could not be loaded from playlist.\n", 1, 100, true); return menu_cbs_exit(); + } playlist_get_index(playlist, playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); @@ -1274,7 +1280,10 @@ static int action_ok_playlist_entry_start_content(const char *path, playlist_info.idx = selection_ptr; if (!menu_content_playlist_load(&playlist_info)) + { + runloop_msg_queue_push("File could not be loaded from playlist.\n", 1, 100, true); return menu_cbs_exit(); + } playlist_get_index(playlist, playlist_info.idx, &path, NULL, NULL, NULL, NULL, NULL); diff --git a/menu/menu_content.c b/menu/menu_content.c index 6bee83478d..d62d491a77 100644 --- a/menu/menu_content.c +++ b/menu/menu_content.c @@ -30,14 +30,9 @@ #include "menu_shader.h" #include "../core_info.h" -#include "../content.h" #include "../configuration.h" -#include "../dynamic.h" #include "../defaults.h" -#include "../frontend/frontend.h" #include "../playlist.h" -#include "../retroarch.h" -#include "../runloop.h" #include "../verbosity.h" /** @@ -58,7 +53,9 @@ bool menu_content_playlist_load(menu_content_ctx_playlist_info_t *info) playlist_get_index(playlist, info->idx, &path, NULL, NULL, NULL, NULL, NULL); - if (!string_is_empty(path)) + if (string_is_empty(path)) + return false; + { unsigned i; bool valid_path = false; @@ -84,14 +81,10 @@ bool menu_content_playlist_load(menu_content_ctx_playlist_info_t *info) free(path_check); if (!valid_path) - goto error; + return false; } return true; - -error: - runloop_msg_queue_push("File could not be loaded from playlist.\n", 1, 100, true); - return false; } bool menu_content_playlist_find_associated_core(const char *path, char *s, size_t len) @@ -106,20 +99,21 @@ bool menu_content_playlist_find_associated_core(const char *path, char *s, size_ for (j = 0; j < existing_core_names->size; j++) { - if (string_is_equal(path, existing_core_names->elems[j].data)) - { - if (existing_core_paths) - { - const char *existing_core = existing_core_paths->elems[j].data; + if (!string_is_equal(path, existing_core_names->elems[j].data)) + continue; - if (existing_core) - { - strlcpy(s, existing_core, len); - ret = true; - } + if (existing_core_paths) + { + const char *existing_core = existing_core_paths->elems[j].data; + + if (existing_core) + { + strlcpy(s, existing_core, len); + ret = true; } - break; } + + break; } string_list_free(existing_core_names); @@ -148,15 +142,9 @@ bool menu_content_find_first_core(menu_content_ctx_defer_info_t *def_info, char *new_core_path, size_t len) { const core_info_t *info = NULL; - core_info_list_t *core_info = NULL; - const char *default_info_dir = NULL; size_t supported = 0; - - if (def_info) - { - core_info = (core_info_list_t*)def_info->data; - default_info_dir = def_info->dir; - } + core_info_list_t *core_info = (core_info_list_t*)def_info->data; + const char *default_info_dir = def_info->dir; if (!string_is_empty(default_info_dir)) {