-/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
knotd_mod_t *query_module_open(conf_t *conf, conf_mod_id_t *mod_id,
- struct query_plan *plan, const knot_dname_t *zone,
- knot_mm_t *mm)
+ struct query_plan *plan, const knot_dname_t *zone)
{
if (conf == NULL || mod_id == NULL || plan == NULL) {
return NULL;
}
/* Create query module. */
- knotd_mod_t *module = mm_calloc(mm, 1, sizeof(knotd_mod_t));
+ knotd_mod_t *module = calloc(1, sizeof(knotd_mod_t));
if (module == NULL) {
return NULL;
}
module->plan = plan;
- module->mm = mm;
module->config = conf;
module->zone = zone;
module->id = mod_id;
knotd_mod_stats_free(module);
conf_free_mod_id(module->id);
- mm_free(module->mm, module);
+ free(module);
}
_public_
mod_ctr_t *stats = NULL;
if (mod->stats == NULL) {
assert(mod->stats_count == 0);
- stats = mm_alloc(mod->mm, sizeof(*stats));
+ stats = malloc(sizeof(*stats));
if (stats == NULL) {
return KNOT_ENOMEM;
}
assert(mod->stats_count > 0);
size_t old_size = mod->stats_count * sizeof(*stats);
size_t new_size = old_size + sizeof(*stats);
- stats = mm_realloc(mod->mm, mod->stats, new_size, old_size);
+ stats = realloc(mod->stats, new_size);
if (stats == NULL) {
knotd_mod_stats_free(mod);
return KNOT_ENOMEM;
stats->counter = 0;
} else {
size_t size = idx_count * sizeof(((mod_ctr_t *)0)->counter);
- stats->counters = mm_calloc(mod->mm, 1, size);
+ stats->counters = calloc(1, size);
if (stats->counters == NULL) {
knotd_mod_stats_free(mod);
return KNOT_ENOMEM;
for (int i = 0; i < mod->stats_count; i++) {
if (mod->stats[i].count > 1) {
- mm_free(mod->mm, mod->stats[i].counters);
+ free(mod->stats[i].counters);
}
}
- mm_free(mod->mm, mod->stats);
+ free(mod->stats);
}
#define STATS_BODY(OPERATION) { \
-/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/*! \brief Open query module identified by name. */
knotd_mod_t *query_module_open(conf_t *conf, conf_mod_id_t *mod_id,
- struct query_plan *plan, const knot_dname_t *zone,
- knot_mm_t *mm);
+ struct query_plan *plan, const knot_dname_t *zone);
/*! \brief Close query module. */
void query_module_close(knotd_mod_t *module);
struct knotd_mod {
node_t node;
- knot_mm_t *mm;
conf_t *config;
conf_mod_id_t *id;
struct query_plan *plan;