This commit is contained in:
Přemysl Eric Janouch 2015-12-11 01:11:09 +01:00
parent 5d3c2bea95
commit de942e40ac
1 changed files with 5 additions and 11 deletions

View File

@ -2010,7 +2010,7 @@ config_schema_call_changed (struct config_item *item)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// XXX: this doesn't necessarily have to be well designed at all
// XXX: the callbacks may be overdesigned and of little to no practical use
typedef void (*config_module_load_fn)
(struct config_item *subtree, void *user_data);
@ -2022,13 +2022,6 @@ struct config_module
void *user_data; ///< User data
};
static struct config_module *
config_module_new ()
{
struct config_module *self = xcalloc (1, sizeof *self);
return self;
}
static void
config_module_destroy (struct config_module *self)
{
@ -2047,7 +2040,7 @@ config_init (struct config *self)
{
memset (self, 0, sizeof *self);
str_map_init (&self->modules);
self->modules.free = (void (*) (void *)) config_module_destroy;
self->modules.free = (str_map_free_fn) config_module_destroy;
}
static void
@ -2062,7 +2055,7 @@ static void
config_register_module (struct config *self,
const char *name, config_module_load_fn loader, void *user_data)
{
struct config_module *module = config_module_new ();
struct config_module *module = xcalloc (1, sizeof *module);
module->name = xstrdup (name);
module->loader = loader;
module->user_data = user_data;
@ -2074,7 +2067,8 @@ static void
config_load (struct config *self, struct config_item *root)
{
hard_assert (root->type == CONFIG_ITEM_OBJECT);
if (self->root) config_item_destroy (self->root);
if (self->root)
config_item_destroy (self->root);
self->root = root;
struct str_map_iter iter;