Commit f46d836b authored by Marek Vavruša's avatar Marek Vavruša

lib: cleanup

parent 794c7ba8
......@@ -44,7 +44,7 @@
* This adds 32 bits of randomness at maximum, but that's more than an average domain name length.
* https://tools.ietf.org/html/draft-vixie-dnsext-dns0x20-00
*/
static void randomized_qname_case(knot_dname_t *qname, unsigned secret)
static void randomized_qname_case(knot_dname_t *qname, uint32_t secret)
{
unsigned k = 0;
while (*qname != '\0') {
......
......@@ -63,7 +63,7 @@ struct kr_query {
uint16_t sclass;
uint16_t id;
uint16_t flags;
unsigned secret;
uint32_t secret;
struct timeval timestamp;
struct kr_nsrep ns;
struct kr_zonecut zone_cut;
......
......@@ -28,7 +28,7 @@
#include <time.h>
#include <libknot/descriptor.h>
#include <ccan/json/json.h>
#include <ccan/asprintf/asprintf.h>
#include <ccan/compiler/compiler.h>
#include "daemon/engine.h"
#include "lib/module.h"
......@@ -210,7 +210,7 @@ static char* clear(void *env, struct kr_module *module, const char *args)
if (args && strlen(args) > 0) {
int ret = cache_prefixed(env, args, 0, &cache_delete_cb, NULL);
if (ret != 0) {
return afmt("%s", kr_strerror(ret));
return strdup(kr_strerror(ret));
}
return strdup("true");
}
......@@ -234,7 +234,7 @@ static char* clear(void *env, struct kr_module *module, const char *args)
lru_deinit(engine->resolver.cache_rep);
lru_init(engine->resolver.cache_rtt, LRU_RTT_SIZE);
lru_init(engine->resolver.cache_rep, LRU_REP_SIZE);
return afmt("%s", ret == 0 ? "true" : kr_strerror(ret));
return strdup(ret == 0 ? "true" : kr_strerror(ret));
}
/** @internal Serialize cached record name into JSON. */
......@@ -250,7 +250,7 @@ static int cache_dump_cb(struct kr_cache_txn *txn, namedb_iter_t *it, namedb_val
/* Extract domain name */
char *dst = buf;
const char *scan = endp - 1;
while (scan > key->data) {
while (scan > (const char *)key->data) {
if (*scan == '\0') {
const size_t lblen = endp - scan - 1;
memcpy(dst, scan + 1, lblen);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment