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