config_file_read not needed anymore

This commit is contained in:
twinaphex 2019-04-30 13:37:10 +02:00
parent 2dbb334fb1
commit bc2bdd5734
27 changed files with 43 additions and 55 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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");

View File

@ -2314,7 +2314,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset(
if (!shader)
return nullptr;
unique_ptr<config_file_t, gl_core::ConfigDeleter> conf{ config_file_read(path) };
unique_ptr<config_file_t, gl_core::ConfigDeleter> conf{ config_file_new(path) };
if (!conf)
return nullptr;

View File

@ -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);

View File

@ -2856,7 +2856,7 @@ vulkan_filter_chain_t *vulkan_filter_chain_create_from_preset(
if (!shader)
return nullptr;
unique_ptr<config_file_t, ConfigDeleter> conf{ config_file_read(path) };
unique_ptr<config_file_t, ConfigDeleter> conf{ config_file_new(path) };
if (!conf)
return nullptr;

View File

@ -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);

View File

@ -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)
{

View File

@ -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;

View File

@ -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.*/

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -132,7 +132,7 @@ void CoreOptionsDialog::onSaveGameSpecificOptions()
return;
}
conf = config_file_read(game_path);
conf = config_file_new(game_path);
if (!conf)
{