Cleanup
This commit is contained in:
parent
5d3c2bea95
commit
de942e40ac
16
common.c
16
common.c
|
@ -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)
|
typedef void (*config_module_load_fn)
|
||||||
(struct config_item *subtree, void *user_data);
|
(struct config_item *subtree, void *user_data);
|
||||||
|
@ -2022,13 +2022,6 @@ struct config_module
|
||||||
void *user_data; ///< User data
|
void *user_data; ///< User data
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct config_module *
|
|
||||||
config_module_new ()
|
|
||||||
{
|
|
||||||
struct config_module *self = xcalloc (1, sizeof *self);
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_module_destroy (struct config_module *self)
|
config_module_destroy (struct config_module *self)
|
||||||
{
|
{
|
||||||
|
@ -2047,7 +2040,7 @@ config_init (struct config *self)
|
||||||
{
|
{
|
||||||
memset (self, 0, sizeof *self);
|
memset (self, 0, sizeof *self);
|
||||||
str_map_init (&self->modules);
|
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
|
static void
|
||||||
|
@ -2062,7 +2055,7 @@ static void
|
||||||
config_register_module (struct config *self,
|
config_register_module (struct config *self,
|
||||||
const char *name, config_module_load_fn loader, void *user_data)
|
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->name = xstrdup (name);
|
||||||
module->loader = loader;
|
module->loader = loader;
|
||||||
module->user_data = user_data;
|
module->user_data = user_data;
|
||||||
|
@ -2074,7 +2067,8 @@ static void
|
||||||
config_load (struct config *self, struct config_item *root)
|
config_load (struct config *self, struct config_item *root)
|
||||||
{
|
{
|
||||||
hard_assert (root->type == CONFIG_ITEM_OBJECT);
|
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;
|
self->root = root;
|
||||||
|
|
||||||
struct str_map_iter iter;
|
struct str_map_iter iter;
|
||||||
|
|
Loading…
Reference in New Issue