This commit is contained in:
twinaphex 2020-08-24 20:40:49 +02:00
parent dd13e6b044
commit 150e96144a

View File

@ -476,6 +476,24 @@ static bool parse_line(config_file_t *conf,
return true;
}
config_file_t *config_file_new_alloc(void)
{
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;
conf->modified = false;
return conf;
}
static config_file_t *config_file_new_internal(
const char *path, unsigned depth, config_file_cb_t *cb)
{
@ -717,24 +735,6 @@ config_file_t *config_file_new(const char *path)
return config_file_new_internal(path, 0, NULL);
}
config_file_t *config_file_new_alloc(void)
{
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;
conf->modified = false;
return conf;
}
struct config_entry_list *config_get_entry(
const config_file_t *conf,
const char *key, struct config_entry_list **prev)