]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
hints nitpicks: inline unload() into hints_deinit()
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 15 Jun 2017 07:52:39 +0000 (09:52 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 15 Jun 2017 14:45:07 +0000 (16:45 +0200)
The API function doesn't do anything else anyway.

modules/hints/hints.c

index c64805276a2b7d5d3d3674e7f9cf8f484251ad8b..f08fef0dbdacb03d7bd1d2a49635537ea887393e 100644 (file)
@@ -365,17 +365,6 @@ static char* hint_add_hosts(void *env, struct kr_module *module, const char *arg
        return bool2jsonstr(err == kr_ok());
 }
 
-static void unload(struct kr_module *module)
-{
-       struct hints_data *data = module->data;
-       if (data) {
-               kr_zonecut_deinit(&data->hints);
-               kr_zonecut_deinit(&data->reverse_hints);
-               mp_delete(data->hints.pool->ctx);
-               module->data = NULL;
-       }
-}
-
 /**
  * Set name => address hint.
  *
@@ -583,6 +572,19 @@ int hints_init(struct kr_module *module)
        return kr_ok();
 }
 
+KR_EXPORT
+int hints_deinit(struct kr_module *module)
+{
+       struct hints_data *data = module->data;
+       if (data) {
+               kr_zonecut_deinit(&data->hints);
+               kr_zonecut_deinit(&data->reverse_hints);
+               mp_delete(data->hints.pool->ctx);
+               module->data = NULL;
+       }
+       return kr_ok();
+}
+
 /** Drop all hints, and load a hosts file if any was specified.
  *
  * It seems slightly strange to drop all, but keep doing that for now.
@@ -590,7 +592,7 @@ int hints_init(struct kr_module *module)
 KR_EXPORT
 int hints_config(struct kr_module *module, const char *conf)
 {
-       unload(module);
+       hints_deinit(module);
        int err = hints_init(module);
        if (err != kr_ok()) {
                return err;
@@ -602,13 +604,6 @@ int hints_config(struct kr_module *module, const char *conf)
        return kr_ok();
 }
 
-KR_EXPORT
-int hints_deinit(struct kr_module *module)
-{
-       unload(module);
-       return kr_ok();
-}
-
 KR_EXPORT
 struct kr_prop *hints_props(void)
 {