From: Vladimír Čunát Date: Thu, 21 Sep 2017 08:51:37 +0000 (+0200) Subject: engine: nitpicks around loading root hints X-Git-Tag: v1.4.0~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37eaf9494f2d79a1f9334d91f745b482fbfaee02;p=thirdparty%2Fknot-resolver.git engine: nitpicks around loading root hints "lua_" in name is not appropriate, as the function does no lua stuff anymore, so let's unify it to "engine_". --- diff --git a/daemon/engine.c b/daemon/engine.c index d18c6e6d1..81c44f7f1 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -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; diff --git a/daemon/engine.h b/daemon/engine.h index b85bea3b2..8bc667017 100644 --- a/daemon/engine.h +++ b/daemon/engine.h @@ -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); diff --git a/modules/hints/hints.c b/modules/hints/hints.c index c20f1c8df..fdd86b275 100644 --- a/modules/hints/hints.c +++ b/modules/hints/hints.c @@ -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); } /*