conf: splitted function config_param_free()

This commit is contained in:
Max Kellermann 2009-09-24 21:40:05 +02:00
parent 1b227e0145
commit f3739a73af

View File

@ -142,10 +142,8 @@ config_new_param(const char *value, int line)
}
static void
config_param_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
config_param_free(struct config_param *param)
{
struct config_param *param = data;
g_free(param->value);
for (unsigned i = 0; i < param->num_block_params; i++) {
@ -159,6 +157,14 @@ config_param_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
g_free(param);
}
static void
config_param_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
{
struct config_param *param = data;
config_param_free(param);
}
static struct config_entry *
config_entry_get(const char *name)
{
@ -176,7 +182,8 @@ void config_global_finish(void)
for (unsigned i = 0; i < G_N_ELEMENTS(config_entries); ++i) {
struct config_entry *entry = &config_entries[i];
g_slist_foreach(entry->params, config_param_free, NULL);
g_slist_foreach(entry->params,
config_param_free_callback, NULL);
g_slist_free(entry->params);
}
}