aboutsummaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-12-11 01:11:09 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-12-11 02:27:29 +0100
commitde942e40ac7e09c16e451c61692528c524e1ebbd (patch)
treeb9d1ed4fc5e768d69ae9e9ccd0976f90601f350a /common.c
parent5d3c2bea95039b73ada6bb00a7e140bab27df02d (diff)
downloadxK-de942e40ac7e09c16e451c61692528c524e1ebbd.tar.gz
xK-de942e40ac7e09c16e451c61692528c524e1ebbd.tar.xz
xK-de942e40ac7e09c16e451c61692528c524e1ebbd.zip
Cleanup
Diffstat (limited to 'common.c')
-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;