]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
engine: nitpicks around loading root hints
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 21 Sep 2017 08:51:37 +0000 (10:51 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 21 Sep 2017 08:55:29 +0000 (10:55 +0200)
"lua_" in name is not appropriate, as the function does no lua stuff
anymore, so let's unify it to "engine_".

daemon/engine.c
daemon/engine.h
modules/hints/hints.c

index d18c6e6d115e2f0ec833d8436b5d57254d2f3706..81c44f7f1194d114f22c3acbf3f32d2ea8419edc 100644 (file)
@@ -320,20 +320,6 @@ static int l_trustanchor(lua_State *L)
        return 1;
 }
 
-/** @internal for l_hints_root_file */
-static void roothints_add(zs_scanner_t *zs)
-{
-       struct kr_zonecut *hints = zs->process.data;
-       if (!hints) {
-               return;
-       }
-       if (zs->r_type == KNOT_RRTYPE_A || zs->r_type == KNOT_RRTYPE_AAAA) {
-               knot_rdata_t rdata[RDATA_ARR_MAX];
-               knot_rdata_init(rdata, zs->r_data_length, zs->r_data, zs->r_ttl);
-               kr_zonecut_add(hints, zs->r_owner, rdata);
-       }
-}
-
 /** Load root hints from zonefile. */
 static int l_hint_root_file(lua_State *L)
 {
@@ -341,7 +327,7 @@ static int l_hint_root_file(lua_State *L)
        struct kr_context *ctx = &engine->resolver;
        const char *file = lua_tostring(L, 1);
 
-       const char *err = lua_hint_root_file(ctx, file);
+       const char *err = engine_hint_root_file(ctx, file);
        if (err) {
                lua_pushstring(L, err);
                lua_error(L);
@@ -351,7 +337,20 @@ static int l_hint_root_file(lua_State *L)
        }
 }
 
-const char* lua_hint_root_file(struct kr_context *ctx, const char *file)
+/** @internal for engine_hint_root_file */
+static void roothints_add(zs_scanner_t *zs)
+{
+       struct kr_zonecut *hints = zs->process.data;
+       if (!hints) {
+               return;
+       }
+       if (zs->r_type == KNOT_RRTYPE_A || zs->r_type == KNOT_RRTYPE_AAAA) {
+               knot_rdata_t rdata[RDATA_ARR_MAX];
+               knot_rdata_init(rdata, zs->r_data_length, zs->r_data, zs->r_ttl);
+               kr_zonecut_add(hints, zs->r_owner, rdata);
+       }
+}
+const char* engine_hint_root_file(struct kr_context *ctx, const char *file)
 {
        if (!file) {
                file = ROOTHINTS;
index b85bea3b2242c037a5ea3ef0031ec86129e23ea3..8bc6670177d2351ce512f4f8329c8d971a9a662c 100644 (file)
@@ -106,5 +106,5 @@ int engine_set_moduledir(struct engine *engine, const char *moduledir);
  *
  * @return error message or NULL (statically allocated)
  */
-const char* lua_hint_root_file(struct kr_context *ctx, const char *file);
+const char* engine_hint_root_file(struct kr_context *ctx, const char *file);
 
index c20f1c8dfd899fe696eb2ae0d689afc3934d80af..fdd86b27584c06f03b6b35e878f8327f06d9835a 100644 (file)
@@ -569,7 +569,7 @@ static char* hint_root_file(void *env, struct kr_module *module, const char *arg
 {
        struct engine *engine = env;
        struct kr_context *ctx = &engine->resolver;
-       return (char*)lua_hint_root_file(ctx, args);
+       return (char *)/*const-cast*/engine_hint_root_file(ctx, args);
 }
 
 /*