mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-03 07:22:15 +00:00
Rename config_file_new_null to config_file_new_alloc
This commit is contained in:
parent
0c31437c24
commit
a6d6c21e52
@ -2424,7 +2424,7 @@ static config_file_t *open_default_config_file(void)
|
||||
bool saved = false;
|
||||
|
||||
/* Try to create a new config file. */
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
@ -2463,7 +2463,7 @@ static config_file_t *open_default_config_file(void)
|
||||
if (!conf)
|
||||
{
|
||||
bool saved = false;
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
@ -2535,7 +2535,7 @@ static config_file_t *open_default_config_file(void)
|
||||
if (conf)
|
||||
RARCH_WARN("Config: using skeleton config \"%s\" as base for a new config file.\n", skeleton_conf);
|
||||
else
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
free(skeleton_conf);
|
||||
|
||||
@ -3639,7 +3639,7 @@ bool config_save_autoconf_profile(const char *path, unsigned user)
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
if (!conf)
|
||||
{
|
||||
free(autoconf_file);
|
||||
@ -3710,7 +3710,7 @@ bool config_save_file(const char *path)
|
||||
int path_settings_size = sizeof(settings->paths) / sizeof(settings->paths.placeholder);
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
if (!conf || rarch_ctl(RARCH_CTL_IS_OVERRIDES_ACTIVE, NULL))
|
||||
{
|
||||
@ -3993,7 +3993,7 @@ bool config_save_overrides(int override_type)
|
||||
path_size);
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new_null();
|
||||
conf = config_file_new_alloc();
|
||||
|
||||
/* Load the original config file in memory */
|
||||
config_load_file(path_get(RARCH_PATH_CONFIG), settings);
|
||||
|
@ -156,7 +156,7 @@ static void salamander_init(char *s, size_t len)
|
||||
|
||||
if (!config_exists)
|
||||
{
|
||||
config_file_t *conf = (config_file_t*)config_file_new_null();
|
||||
config_file_t *conf = (config_file_t*)config_file_new_alloc();
|
||||
|
||||
if (conf)
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ bool input_remapping_save_file(const char *path)
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
if (!(conf = config_file_new_null()))
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
{
|
||||
free(remap_file);
|
||||
return false;
|
||||
|
@ -396,17 +396,7 @@ static config_file_t *config_file_new_internal(
|
||||
const char *path, unsigned depth, config_file_cb_t *cb)
|
||||
{
|
||||
RFILE *file = NULL;
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
conf->path = NULL;
|
||||
conf->entries = NULL;
|
||||
conf->tail = NULL;
|
||||
conf->last = NULL;
|
||||
conf->includes = NULL;
|
||||
conf->include_depth = 0;
|
||||
conf->guaranteed_no_duplicates = false ;
|
||||
struct config_file *conf = config_file_new_alloc();
|
||||
|
||||
if (!path || !*path)
|
||||
return conf;
|
||||
@ -614,7 +604,7 @@ config_file_t *config_file_new(const char *path)
|
||||
return config_file_new_internal(path, 0, NULL);
|
||||
}
|
||||
|
||||
config_file_t *config_file_new_null(void)
|
||||
config_file_t *config_file_new_alloc(void)
|
||||
{
|
||||
struct config_file *conf = (struct config_file*)malloc(sizeof(*conf));
|
||||
if (!conf)
|
||||
|
@ -86,7 +86,7 @@ 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);
|
||||
|
||||
config_file_t *config_file_new_null(void);
|
||||
config_file_t *config_file_new_alloc(void);
|
||||
|
||||
/* Loads a config file. Returns NULL if file doesn't exist.
|
||||
* NULL path will create an empty config file.
|
||||
|
@ -168,7 +168,7 @@ bool cheat_manager_save(const char *path, const char *cheat_database, bool overw
|
||||
conf = config_file_new(cheats_file);
|
||||
|
||||
if (!conf)
|
||||
if (!(conf = config_file_new_null()))
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
return false;
|
||||
|
||||
conf->guaranteed_no_duplicates = true;
|
||||
|
@ -4037,7 +4037,7 @@ static int action_ok_option_create(const char *path,
|
||||
conf = config_file_new(game_path);
|
||||
|
||||
if (!conf)
|
||||
if (!(conf = config_file_new_null()))
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
return false;
|
||||
|
||||
if (config_file_write(conf, game_path, true))
|
||||
|
@ -357,7 +357,7 @@ bool menu_shader_manager_save_preset(
|
||||
dirs[2] = config_directory;
|
||||
}
|
||||
|
||||
if (!(conf = (config_file_t*)config_file_new_null()))
|
||||
if (!(conf = (config_file_t*)config_file_new_alloc()))
|
||||
return false;
|
||||
|
||||
if (fullpath)
|
||||
|
12
retroarch.c
12
retroarch.c
@ -2086,13 +2086,11 @@ static core_option_manager_t *core_option_manager_new_vars(const char *conf_path
|
||||
}
|
||||
|
||||
if (!opt->conf)
|
||||
opt->conf = config_file_new_null();
|
||||
if (!(opt->conf = config_file_new_alloc()))
|
||||
goto error;
|
||||
|
||||
strlcpy(opt->conf_path, conf_path, sizeof(opt->conf_path));
|
||||
|
||||
if (!opt->conf)
|
||||
goto error;
|
||||
|
||||
for (var = vars; var->key && var->value; var++)
|
||||
size++;
|
||||
|
||||
@ -2154,13 +2152,11 @@ static core_option_manager_t *core_option_manager_new(const char *conf_path,
|
||||
}
|
||||
|
||||
if (!opt->conf)
|
||||
opt->conf = config_file_new_null();
|
||||
if (!(opt->conf = config_file_new_alloc()))
|
||||
goto error;
|
||||
|
||||
strlcpy(opt->conf_path, conf_path, sizeof(opt->conf_path));
|
||||
|
||||
if (!opt->conf)
|
||||
goto error;
|
||||
|
||||
/* Note: 'option_def->info == NULL' is valid */
|
||||
for (option_def = option_defs;
|
||||
option_def->key && option_def->desc && option_def->values[0].value;
|
||||
|
@ -137,7 +137,7 @@ void CoreOptionsDialog::onSaveGameSpecificOptions()
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
if (!(conf = config_file_new_null()))
|
||||
if (!(conf = config_file_new_alloc()))
|
||||
{
|
||||
QMessageBox::critical(this, msg_hash_to_str(MSG_ERROR), msg_hash_to_str(MSG_ERROR_SAVING_CORE_OPTIONS_FILE));
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user