From: Vladimír Čunát Date: Mon, 8 May 2023 08:25:15 +0000 (+0200) Subject: hints: cleanup unused parts of code X-Git-Tag: v6.0.1~9^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a2d021a82ca8c9006b8073e3fc680fada4b9cd8;p=thirdparty%2Fknot-resolver.git hints: cleanup unused parts of code --- diff --git a/modules/hints/hints.c b/modules/hints/hints.c index 16d102910..1f8e68763 100644 --- a/modules/hints/hints.c +++ b/modules/hints/hints.c @@ -30,8 +30,6 @@ #define ERR_MSG(...) kr_log_error(HINT, "[ ]" __VA_ARGS__) struct hints_data { - struct kr_zonecut hints; - struct kr_zonecut reverse_hints; bool use_nodata; /**< See hint_use_nodata() description, exposed via lua. */ uint32_t ttl; /**< TTL used for the hints, exposed via lua. */ }; @@ -357,7 +355,6 @@ static JsonNode *pack_addrs(pack_t *pack) return root; } -static char* pack_hints(struct kr_zonecut *hints); /** * Retrieve address hints, either for given name or for all names. * @@ -510,17 +507,9 @@ int hints_init(struct kr_module *module) }; module->props = props; - knot_mm_t *pool = mm_ctx_mempool2(MM_DEFAULT_BLKSIZE); - if (!pool) { + struct hints_data *data = malloc(sizeof(*data)); + if (!data) return kr_error(ENOMEM); - } - struct hints_data *data = mm_alloc(pool, sizeof(struct hints_data)); - if (!data) { - mp_delete(pool->ctx); - return kr_error(ENOMEM); - } - kr_zonecut_init(&data->hints, (const uint8_t *)(""), pool); - kr_zonecut_init(&data->reverse_hints, (const uint8_t *)(""), pool); data->use_nodata = true; data->ttl = HINTS_TTL_DEFAULT; module->data = data; @@ -532,13 +521,8 @@ int hints_init(struct kr_module *module) 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; - } + free(module->data); + module->data = NULL; return kr_ok(); }