diff --git a/configuration.c b/configuration.c index ff68547420..f1a9b4e260 100644 --- a/configuration.c +++ b/configuration.c @@ -3445,7 +3445,7 @@ bool config_load_remap(void) path_size); /* Create a new config file from game_path */ - new_conf = config_file_read(game_path); + new_conf = config_file_new(game_path); /* If a game remap file exists, load it. */ if (new_conf) @@ -3467,7 +3467,7 @@ bool config_load_remap(void) } /* Create a new config file from content_path */ - new_conf = config_file_read(content_path); + new_conf = config_file_new(content_path); /* If a content-dir remap file exists, load it. */ if (new_conf) @@ -3489,7 +3489,7 @@ bool config_load_remap(void) } /* Create a new config file from core_path */ - new_conf = config_file_read(core_path); + new_conf = config_file_new(core_path); /* If a core remap file exists, load it. */ if (new_conf) @@ -3746,7 +3746,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user) free(buf); free(path_new); - conf = config_file_read(autoconf_file); + conf = config_file_new(autoconf_file); if (!conf) { @@ -3810,7 +3810,7 @@ bool config_save_file(const char *path) struct config_float_setting *float_settings = NULL; struct config_array_setting *array_settings = NULL; struct config_path_setting *path_settings = NULL; - config_file_t *conf = config_file_read(path); + config_file_t *conf = config_file_new(path); settings_t *settings = config_get_ptr(); int bool_settings_size = sizeof(settings->bools) / sizeof(settings->bools.placeholder); int float_settings_size = sizeof(settings->floats)/ sizeof(settings->floats.placeholder); diff --git a/core_info.c b/core_info.c index a2d974e1c7..37cc7d1827 100644 --- a/core_info.c +++ b/core_info.c @@ -225,7 +225,7 @@ static config_file_t *core_info_list_iterate( info_path_base = NULL; if (path_is_valid(info_path)) - conf = config_file_read(info_path); + conf = config_file_new(info_path); free(info_path); return conf; @@ -915,7 +915,7 @@ bool core_info_list_get_display_name(core_info_list_t *core_info_list, bool core_info_get_display_name(const char *path, char *s, size_t len) { char *tmp = NULL; - config_file_t *conf = config_file_read(path); + config_file_t *conf = config_file_new(path); if (!conf) return false; diff --git a/frontend/frontend_salamander.c b/frontend/frontend_salamander.c index 5602af170c..1c13fa4b67 100644 --- a/frontend/frontend_salamander.c +++ b/frontend/frontend_salamander.c @@ -123,8 +123,7 @@ static void salamander_init(char *s, size_t len) if (config_exists) { char tmp_str[PATH_MAX_LENGTH] = {0}; - config_file_t * conf = (config_file_t*) - config_file_read(g_defaults.path.config); + config_file_t * conf = config_file_new(g_defaults.path.config); if (conf) { diff --git a/gfx/common/metal_common.m b/gfx/common/metal_common.m index f5b7e883bd..d91ca2488e 100644 --- a/gfx/common/metal_common.m +++ b/gfx/common/metal_common.m @@ -1133,7 +1133,7 @@ typedef struct MTLALIGN(16) [self _freeVideoShader:_shader]; _shader = nil; - config_file_t *conf = config_file_read(path.UTF8String); + config_file_t *conf = config_file_new(path.UTF8String); struct video_shader *shader = (struct video_shader *)calloc(1, sizeof(*shader)); @try diff --git a/gfx/drivers/d3d10.c b/gfx/drivers/d3d10.c index b0a3dbb9c5..ae6f721078 100644 --- a/gfx/drivers/d3d10.c +++ b/gfx/drivers/d3d10.c @@ -346,7 +346,7 @@ static bool d3d10_gfx_set_shader(void* data, return false; } - conf = config_file_read(path); + conf = config_file_new(path); if (!conf) return false; diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index f249b2ef7b..924e80b011 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -364,7 +364,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const return false; } - conf = config_file_read(path); + conf = config_file_new(path); if (!conf) return false; diff --git a/gfx/drivers/d3d12.c b/gfx/drivers/d3d12.c index c479177c43..fbc6af4ac2 100644 --- a/gfx/drivers/d3d12.c +++ b/gfx/drivers/d3d12.c @@ -334,8 +334,9 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const { #if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS) unsigned i; - d3d12_texture_t* source; - d3d12_video_t* d3d12 = (d3d12_video_t*)data; + d3d12_texture_t* source = NULL; + config_file_t* conf = NULL; + d3d12_video_t* d3d12 = (d3d12_video_t*)data; if (!d3d12) return false; @@ -353,7 +354,7 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const return false; } - config_file_t* conf = config_file_read(path); + conf = config_file_new(path); if (!conf) return false; diff --git a/gfx/drivers/d3d9.c b/gfx/drivers/d3d9.c index a6b098fe89..e8797b092f 100644 --- a/gfx/drivers/d3d9.c +++ b/gfx/drivers/d3d9.c @@ -364,7 +364,7 @@ static bool d3d9_init_multipass(d3d9_video_t *d3d, const char *shader_path) unsigned i; bool use_extra_pass = false; struct video_shader_pass *pass = NULL; - config_file_t *conf = config_file_read(shader_path); + config_file_t *conf = config_file_new(shader_path); if (!conf) { diff --git a/gfx/drivers/gx2_gfx.c b/gfx/drivers/gx2_gfx.c index 5bda58f966..e3f0f63822 100644 --- a/gfx/drivers/gx2_gfx.c +++ b/gfx/drivers/gx2_gfx.c @@ -1409,9 +1409,10 @@ static bool wiiu_gfx_suppress_screensaver(void *data, bool enable) } static bool wiiu_gfx_set_shader(void *data, - enum rarch_shader_type type, const char *path) + enum rarch_shader_type type, const char *path) { - wiiu_video_t *wiiu = (wiiu_video_t *)data; + config_file_t *conf = NULL; + wiiu_video_t *wiiu = (wiiu_video_t *)data; if (!wiiu) return false; @@ -1428,7 +1429,7 @@ static bool wiiu_gfx_set_shader(void *data, if (!path) return true; - config_file_t *conf = config_file_read(path); + config_file_t *conf = config_file_new(path); if (!conf) return false; diff --git a/gfx/drivers_shader/shader_gl_cg.c b/gfx/drivers_shader/shader_gl_cg.c index c9c2ad5a7c..71e805b76e 100644 --- a/gfx/drivers_shader/shader_gl_cg.c +++ b/gfx/drivers_shader/shader_gl_cg.c @@ -773,7 +773,7 @@ static bool gl_cg_load_preset(void *data, const char *path) return false; RARCH_LOG("[CG]: Loading Cg meta-shader: %s\n", path); - conf = config_file_read(path); + conf = config_file_new(path); if (!conf) { RARCH_ERR("Failed to load preset.\n"); diff --git a/gfx/drivers_shader/shader_gl_core.cpp b/gfx/drivers_shader/shader_gl_core.cpp index d5d89e59d5..5311314900 100644 --- a/gfx/drivers_shader/shader_gl_core.cpp +++ b/gfx/drivers_shader/shader_gl_core.cpp @@ -2314,7 +2314,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( if (!shader) return nullptr; - unique_ptr conf{ config_file_read(path) }; + unique_ptr conf{ config_file_new(path) }; if (!conf) return nullptr; diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c index b34277ff4f..3550074eae 100644 --- a/gfx/drivers_shader/shader_glsl.c +++ b/gfx/drivers_shader/shader_glsl.c @@ -896,7 +896,7 @@ static void *gl_glsl_init(void *data, const char *path) if (string_is_equal(path_ext, "glslp")) { - conf = config_file_read(path); + conf = config_file_new(path); if (conf) { ret = video_shader_read_conf_cgp(conf, glsl->shader); diff --git a/gfx/drivers_shader/shader_vulkan.cpp b/gfx/drivers_shader/shader_vulkan.cpp index 9064c19f58..81e2849ab1 100644 --- a/gfx/drivers_shader/shader_vulkan.cpp +++ b/gfx/drivers_shader/shader_vulkan.cpp @@ -2856,7 +2856,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset( if (!shader) return nullptr; - unique_ptr conf{ config_file_read(path) }; + unique_ptr conf{ config_file_new(path) }; if (!conf) return nullptr; diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 8f62ebf638..5e4fcb8dc4 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -404,7 +404,7 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_config, if (!filt) return NULL; - filt->conf = config_file_read(filter_config); + filt->conf = config_file_new(filter_config); if (!filt->conf) { RARCH_ERR("[SoftFilter]: Did not find config: %s\n", filter_config); diff --git a/input/input_remapping.c b/input/input_remapping.c index f9db344592..ba231c2a11 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -166,7 +166,7 @@ bool input_remapping_save_file(const char *path) free(buf); - conf = config_file_read(remap_file); + conf = config_file_new(remap_file); if (!conf) { diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index ea79e35d45..f729b4051f 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -612,11 +612,6 @@ config_file_t *config_file_new(const char *path) return config_file_new_internal(path, 0, NULL); } -config_file_t *config_file_read(const char *path) -{ - return config_file_new_internal(path, 0, NULL); -} - static struct config_entry_list *config_get_entry( const config_file_t *conf, const char *key, struct config_entry_list **prev) @@ -1106,7 +1101,7 @@ bool config_get_entry_list_next(struct config_file_entry *entry) bool config_file_exists(const char *path) { - config_file_t *config = config_file_read(path); + config_file_t *config = config_file_new(path); if (!config) return false; diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index 6174907c37..e4e7eb585d 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -86,11 +86,6 @@ typedef struct config_file_cb config_file_cb_t ; * NULL path will create an empty config file. */ config_file_t *config_file_new(const char *path); -/* Is the same as config_file_new, with the only difference that - * it doesn't check if the path provided is a directory. This can - * be significantly faster on platforms where file I/O is slow */ -config_file_t *config_file_read(const char *path); - /* Loads a config file. Returns NULL if file doesn't exist. * NULL path will create an empty config file. * Includes cb callbacks to run custom code during config file processing.*/ diff --git a/managers/cheat_manager.c b/managers/cheat_manager.c index 1da65c2e29..f08abbf52f 100644 --- a/managers/cheat_manager.c +++ b/managers/cheat_manager.c @@ -170,7 +170,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw } if (!overwrite) - conf = config_file_read(cheats_file); + conf = config_file_new(cheats_file); if (!conf) conf = config_file_new(NULL); diff --git a/managers/core_option_manager.c b/managers/core_option_manager.c index 2d4be0d4e6..87ea3e23ca 100644 --- a/managers/core_option_manager.c +++ b/managers/core_option_manager.c @@ -178,7 +178,7 @@ core_option_manager_t *core_option_manager_new(const char *conf_path, return NULL; if (!string_is_empty(conf_path)) - opt->conf = config_file_read(conf_path); + opt->conf = config_file_new(conf_path); if (!opt->conf) opt->conf = config_file_new(NULL); diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index ad82b5eff1..76434fcce2 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -207,7 +207,7 @@ static int deferred_push_cursor_manager_list_deferred( char *rdb = NULL; settings_t *settings = config_get_ptr(); const char *path = info->path; - config_file_t *conf = path ? config_file_read(path) : NULL; + config_file_t *conf = path ? config_file_new(path) : NULL; if (!conf || !settings) goto end; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a38b762a80..02c5e41405 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1486,7 +1486,7 @@ static int generic_action_ok(const char *path, break; case ACTION_OK_LOAD_REMAPPING_FILE: { - config_file_t *conf = config_file_read(action_path); + config_file_t *conf = config_file_new(action_path); flush_char = msg_hash_to_str(flush_id); if (conf) @@ -3777,7 +3777,7 @@ static int action_ok_option_create(const char *path, return 0; } - conf = config_file_read(game_path); + conf = config_file_new(game_path); if (!conf) { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index aaf78840bc..389f521ea4 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -1889,7 +1889,7 @@ static void load_custom_theme(rgui_t *rgui, rgui_theme_t *theme_colors, const ch goto end; /* Open config file */ - conf = config_file_read(theme_path); + conf = config_file_new(theme_path); if (!conf) goto end; diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 6729b0707a..ca50747e22 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -109,14 +109,14 @@ bool menu_shader_manager_init(void) { fill_pathname_join(preset_path, shader_dir, "menu.cgp", sizeof(preset_path)); - found = config_file_read(preset_path); + found = config_file_new(preset_path); } if (!found) { fill_pathname_join(preset_path, shader_dir, "menu.slangp", sizeof(preset_path)); - found = config_file_read(preset_path); + found = config_file_new(preset_path); } new_path = strdup(preset_path); @@ -125,7 +125,7 @@ bool menu_shader_manager_init(void) if (!string_is_empty(new_path) && found) { - config_file_t *conf = config_file_read(new_path); + config_file_t *conf = config_file_new(new_path); video_shader_read_conf_cgp(conf, menu_driver_shader); video_shader_resolve_relative(menu_driver_shader, new_path); video_shader_resolve_parameters(conf, menu_driver_shader); @@ -174,7 +174,7 @@ bool menu_shader_manager_set_preset(void *data, * Used when a preset is directly loaded. * No point in updating when the Preset was * created from the menu itself. */ - conf = config_file_read(preset_path); + conf = config_file_new(preset_path); if (!conf) return false; diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index b9ac661691..eb6a18b3d4 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -764,7 +764,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, if (!config) return true; - params->conf = config_file_read(config); + params->conf = config_file_new(config); RARCH_LOG("[FFmpeg] Loading FFmpeg config \"%s\".\n", config); if (!params->conf) { diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index 80c9df3fc7..cfc3135b7e 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -352,14 +352,11 @@ static bool input_autoconfigure_joypad_from_conf_dir( return false; } - if (list) - { - RARCH_LOG("[Autoconf]: %d profiles found.\n", (int)list->size); - } + RARCH_LOG("[Autoconf]: %d profiles found.\n", (int)list->size); for (i = 0; i < list->size; i++) { - conf = config_file_read(list->elems[i].data); + conf = config_file_new(list->elems[i].data); if (conf) ret = input_autoconfigure_joypad_try_from_conf(conf, params); @@ -374,7 +371,7 @@ static bool input_autoconfigure_joypad_from_conf_dir( if (index >= 0 && current_best > 0) { - conf = config_file_read(list->elems[index].data); + conf = config_file_new(list->elems[index].data); if (conf) { diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index 6a6a2ac61a..da6dfd49b0 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -749,7 +749,7 @@ bool task_push_overlay_load_default( if (task_queue_find(&find_data)) goto error; - conf = config_file_read(overlay_path); + conf = config_file_new(overlay_path); if (!conf) goto error; diff --git a/ui/drivers/qt/coreoptionsdialog.cpp b/ui/drivers/qt/coreoptionsdialog.cpp index a9e414a89f..82c9cebf15 100644 --- a/ui/drivers/qt/coreoptionsdialog.cpp +++ b/ui/drivers/qt/coreoptionsdialog.cpp @@ -132,7 +132,7 @@ void CoreOptionsDialog::onSaveGameSpecificOptions() return; } - conf = config_file_read(game_path); + conf = config_file_new(game_path); if (!conf) {