aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/common.c b/common.c
index cf950c8..a72453b 100644
--- a/common.c
+++ b/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)
(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;