Prefer config_file_read instead of config_file_new when we are

sure the path cannot be a directory path
This commit is contained in:
twinaphex 2019-04-22 01:23:50 +02:00
parent 69168ec6bc
commit 16e2db25c4
3 changed files with 14 additions and 13 deletions

View File

@ -833,7 +833,7 @@ void core_info_get_name(const char *path, char *s, size_t len,
continue; continue;
} }
conf = config_file_new(info_path); conf = config_file_read(info_path);
if (!conf) if (!conf)
{ {
@ -985,7 +985,7 @@ bool core_info_get_display_name(const char *path, char *s, size_t len)
{ {
bool ret = true; bool ret = true;
char *tmp = NULL; char *tmp = NULL;
config_file_t *conf = config_file_new(path); config_file_t *conf = config_file_read(path);
if (!conf) if (!conf)
{ {

View File

@ -2702,7 +2702,8 @@ static int action_ok_core_deferred_set(const char *new_core_path,
{ {
struct playlist_entry entry = {0}; struct playlist_entry entry = {0};
/* the update function reads our entry as const, so these casts are safe */ /* the update function reads our entry
* as const, so these casts are safe */
entry.label = (char*)content_label; entry.label = (char*)content_label;
entry.core_path = (char*)new_core_path; entry.core_path = (char*)new_core_path;
entry.core_name = core_display_name; entry.core_name = core_display_name;

View File

@ -149,7 +149,7 @@ void input_autoconfigure_joypad_reindex_devices()
continue; continue;
/*another device with the same name found, for the first time*/ /*another device with the same name found, for the first time*/
if(string_is_equal(tmp, other) && if (string_is_equal(tmp, other) &&
input_device_name_index[j]==0 ) input_device_name_index[j]==0 )
{ {
/*Mark the first device of the set*/ /*Mark the first device of the set*/
@ -203,9 +203,9 @@ static int input_autoconfigure_joypad_try_from_conf(config_file_t *conf,
#if 0 #if 0
else else
{ {
if(string_is_empty(params->name)) if (string_is_empty(params->name))
RARCH_LOG("[autoconf]: failed match because params->name was empty\n"); RARCH_LOG("[autoconf]: failed match because params->name was empty\n");
else if(string_is_empty(ident)) else if (string_is_empty(ident))
RARCH_LOG("[autoconf]: failed match because ident was empty\n"); RARCH_LOG("[autoconf]: failed match because ident was empty\n");
else else
RARCH_LOG("[autoconf]: failed match because ident '%s' != param->name '%s'\n", RARCH_LOG("[autoconf]: failed match because ident '%s' != param->name '%s'\n",
@ -250,7 +250,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
(string_is_empty(display_name) && (string_is_empty(display_name) &&
!string_is_empty(params->name)) ? params->name : (!string_is_empty(display_name) ? display_name : "N/A")); !string_is_empty(params->name)) ? params->name : (!string_is_empty(display_name) ? display_name : "N/A"));
if(!remote_is_bound) if (!remote_is_bound)
{ {
task_free_title(task); task_free_title(task);
task_set_title(task, strdup(msg)); task_set_title(task, strdup(msg));
@ -346,7 +346,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
DIR_LIST_AUTOCONFIG, "cfg"); DIR_LIST_AUTOCONFIG, "cfg");
} }
if(!list) if (!list)
{ {
RARCH_LOG("[autoconf]: No profiles found.\n"); RARCH_LOG("[autoconf]: No profiles found.\n");
return false; return false;
@ -359,12 +359,12 @@ static bool input_autoconfigure_joypad_from_conf_dir(
for (i = 0; i < list->size; i++) for (i = 0; i < list->size; i++)
{ {
conf = config_file_new(list->elems[i].data); conf = config_file_read(list->elems[i].data);
if (conf) if (conf)
ret = input_autoconfigure_joypad_try_from_conf(conf, params); ret = input_autoconfigure_joypad_try_from_conf(conf, params);
if(ret >= current_best) if (ret >= current_best)
{ {
index = (int)i; index = (int)i;
current_best = ret; current_best = ret;
@ -372,9 +372,9 @@ static bool input_autoconfigure_joypad_from_conf_dir(
config_file_free(conf); config_file_free(conf);
} }
if(index >= 0 && current_best > 0) if (index >= 0 && current_best > 0)
{ {
conf = config_file_new(list->elems[index].data); conf = config_file_read(list->elems[index].data);
if (conf) if (conf)
{ {