From: Karel Slany Date: Fri, 10 Apr 2015 10:46:37 +0000 (+0200) Subject: style: Fixed indentation and removed trailing white spaces in C code. X-Git-Tag: v1.0.0-beta1~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ed2558b42075493d4be9fb1ac522b54f54c1c54;p=thirdparty%2Fknot-resolver.git style: Fixed indentation and removed trailing white spaces in C code. --- diff --git a/daemon/bindings.c b/daemon/bindings.c index 7eebee38a..e28aafb6e 100644 --- a/daemon/bindings.c +++ b/daemon/bindings.c @@ -204,7 +204,7 @@ static int net_interfaces(lua_State *L) } *(p - 1) = '\0'; lua_pushstring(L, buf); - lua_setfield(L, -2, "mac"); + lua_setfield(L, -2, "mac"); /* Push table */ lua_setfield(L, -2, iface.name); @@ -273,4 +273,4 @@ int lib_cache(lua_State *L) register_lib(L, "cache", lib); return 1; -} \ No newline at end of file +} diff --git a/daemon/engine.c b/daemon/engine.c index 8c88b4eda..c26cd42e4 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -37,7 +37,7 @@ /** Print help and available commands. */ static int l_help(lua_State *L) { - static const char *help_str = + static const char *help_str = "help()\n show this help\n" "quit()\n quit\n" "modules.list()\n list modules\n" @@ -242,7 +242,7 @@ int engine_start(struct engine *engine) return ret; } - return uv_run(uv_default_loop(), UV_RUN_DEFAULT); + return uv_run(uv_default_loop(), UV_RUN_DEFAULT); } void engine_stop(struct engine *engine) @@ -320,8 +320,8 @@ void engine_lualib(struct engine *engine, const char *name, lua_CFunction lib_cb struct engine *engine_luaget(lua_State *L) { - lua_getglobal(L, "__engine"); + lua_getglobal(L, "__engine"); struct engine *engine = lua_touserdata(L, -1); lua_pop(engine->L, 1); return engine; -} \ No newline at end of file +} diff --git a/daemon/engine.h b/daemon/engine.h index 98712bb50..d7acd94d8 100644 --- a/daemon/engine.h +++ b/daemon/engine.h @@ -41,4 +41,4 @@ int engine_register(struct engine *engine, const char *module); int engine_unregister(struct engine *engine, const char *module); /** Return engine light userdata. */ void engine_lualib(struct engine *engine, const char *name, int (*lib_cb) (struct lua_State *)); -struct engine *engine_luaget(struct lua_State *L); \ No newline at end of file +struct engine *engine_luaget(struct lua_State *L); diff --git a/daemon/main.c b/daemon/main.c index 1a1e0a53f..ef5bc3790 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -70,7 +70,7 @@ static const char *set_addr(char *addr, int *port) *port = atoi(p + 1); *p = '\0'; } - + return addr; } @@ -114,7 +114,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } printf("[system] rundir '%s'\n", argv[optind]); - } + } /* Block signals. */ uv_loop_t *loop = uv_default_loop(); diff --git a/daemon/network.c b/daemon/network.c index 2b3af1780..ee2bb1bfc 100644 --- a/daemon/network.c +++ b/daemon/network.c @@ -161,7 +161,7 @@ int network_close(struct network *net, const char *addr, uint16_t port) break; } } - + /* Collapse key if it has no endpoint. */ if (ep_array->len == 0) { free(ep_array); diff --git a/daemon/worker.h b/daemon/worker.h index fff2d521e..72e27896c 100644 --- a/daemon/worker.h +++ b/daemon/worker.h @@ -31,7 +31,7 @@ struct worker_ctx { /** * Resolve query. - * + * * @param worker * @param answer * @param query diff --git a/include/kgetdns.h b/include/kgetdns.h index d9d7f6929..73ed90ab9 100644 --- a/include/kgetdns.h +++ b/include/kgetdns.h @@ -346,7 +346,7 @@ getdns_return_t getdns_context_set_edns_version( /** * Set EDNS DO (DNSSEC OK) bit. - * + * * @param value EDNS DO bit (0 or 1, default 0). */ getdns_return_t getdns_context_set_edns_do_bit( diff --git a/lib/cache.c b/lib/cache.c index 2a48f7b49..cba0fc81c 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -163,7 +163,7 @@ knot_rrset_t kr_cache_materialize(const knot_rrset_t *src, uint32_t drift, mm_ct if (copy.owner == NULL) { return copy; } - + for (uint16_t i = 0; i < src->rrs.rr_count; ++i) { knot_rdata_t *rd = knot_rdataset_at(&src->rrs, i); if (knot_rdata_ttl(rd) > drift) { @@ -173,13 +173,13 @@ knot_rrset_t kr_cache_materialize(const knot_rrset_t *src, uint32_t drift, mm_ct } } } - + /* Update TTLs. */ for (uint16_t i = 0; i < copy.rrs.rr_count; ++i) { knot_rdata_t *rd = knot_rdataset_at(©.rrs, i); knot_rdata_set_ttl(rd, knot_rdata_ttl(rd) - drift); } - + return copy; } diff --git a/lib/cache.h b/lib/cache.h index 23c864b94..371a48f2e 100644 --- a/lib/cache.h +++ b/lib/cache.h @@ -15,7 +15,7 @@ */ /** \addtogroup cache - * @{ + * @{ */ #pragma once diff --git a/lib/defines.h b/lib/defines.h index 3604b0039..9121fa681 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -15,7 +15,7 @@ */ /** \addtogroup resolution - * @{ + * @{ */ #pragma once @@ -47,6 +47,6 @@ */ #define KR_DNS_PORT 53 #define KR_EDNS_VERSION 0 -#define KR_EDNS_PAYLOAD 4096 +#define KR_EDNS_PAYLOAD 4096 /** @} */ diff --git a/lib/generic/array.h b/lib/generic/array.h index c4191357a..8fa93809f 100644 --- a/lib/generic/array.h +++ b/lib/generic/array.h @@ -20,17 +20,17 @@ * \note The C has no generics, so it is implemented mostly using macros. * Be aware of that, as direct usage of the macros in the evaluating macros * may lead to different expectations, i.e. - * + * * MIN(array_push(arr, val)) * * May evaluate the code twice, leading to unexpected behaviour. * This is a price to pay for absence of proper generics. * * Example usage: - * + * * array_t(const char*) arr; * array_init(arr); - * + * * // Reserve memory in advance * if (array_reserve(arr, 2) < 0) { * return ENOMEM; @@ -52,9 +52,9 @@ * * // Random delete * array_del(arr, 0); - * + * * \addtogroup generics - * @{ + * @{ */ #pragma once diff --git a/lib/generic/map.c b/lib/generic/map.c index 1242d84a1..683db2846 100644 --- a/lib/generic/map.c +++ b/lib/generic/map.c @@ -108,7 +108,7 @@ static cb_data_t *cbt_make_data(map_t *map, const uint8_t *str, size_t len, void x->value = value; memcpy(x->key, str, len); } - return x; + return x; } /*! Creates a new, empty critbit map */ diff --git a/lib/generic/map.h b/lib/generic/map.h index 8126008af..25258d198 100644 --- a/lib/generic/map.h +++ b/lib/generic/map.h @@ -7,14 +7,14 @@ * Generics - A Crit-bit tree 'map' implementation. * * @warning If the user provides a custom allocator, it must return addresses aligned to 2B boundary. - * + * * Example usage: - * + * * map_t map = map_make(); * - * // Custom allocator (optional) - * map.malloc = &mymalloc; - * map.baton = &mymalloc_context; + * // Custom allocator (optional) + * map.malloc = &mymalloc; + * map.baton = &mymalloc_context; * * // Insert keys * if (map_set(&map, "princess") != 0 || @@ -29,7 +29,7 @@ * } * * // Prefix search - * int i = 0; + * int i = 0; * int count(const char *s, void *n) { (*(int *)n)++; return 0; } * if (map_walk_prefixed(map, "princ", count, &i) == 0) { * printf("%d matches\n", i); @@ -42,9 +42,9 @@ * * // Clear the map * map_clear(&map); - * + * * \addtogroup generics - * @{ + * @{ */ #pragma once @@ -94,4 +94,4 @@ int map_walk_prefixed(map_t *map, const char *prefix, } #endif -/** @} */ \ No newline at end of file +/** @} */ diff --git a/lib/generic/set.h b/lib/generic/set.h index a288b6730..39427b408 100644 --- a/lib/generic/set.h +++ b/lib/generic/set.h @@ -2,9 +2,9 @@ * Generics - A Crit-bit set implementation. * * @note The API is based on @fn map.h, see it for more examples. - * + * * Example usage: - * + * * set_t set = set_make(); * * // Insert keys @@ -20,7 +20,7 @@ * } * * // Prefix search - * int i = 0; + * int i = 0; * int count(const char *s, void *n) { (*(int *)n)++; return 0; } * if (set_walk_prefixed(set, "princ", count, &i) == 0) { * printf("%d matches\n", i); @@ -33,9 +33,9 @@ * * // Clear the set * set_clear(&set); - * + * * \addtogroup generics - * @{ + * @{ */ #pragma once diff --git a/lib/layer.h b/lib/layer.h index 1d25a3d2f..6dd115d2d 100644 --- a/lib/layer.h +++ b/lib/layer.h @@ -17,7 +17,7 @@ #pragma once /** \addtogroup rplan - * @{ + * @{ */ #include diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c index bbd5e8fd4..271f9e95e 100644 --- a/lib/layer/iterate.c +++ b/lib/layer/iterate.c @@ -35,7 +35,7 @@ enum { PKT_NOERROR = 1 << 0, /* Positive response */ PKT_NODATA = 1 << 1, /* No data response */ PKT_NXDOMAIN = 1 << 2, /* Negative response */ - PKT_ERROR = 1 << 3 /* Refused or server failure */ + PKT_ERROR = 1 << 3 /* Refused or server failure */ }; /* Iterator often walks through packet section, this is an abstraction. */ @@ -155,7 +155,7 @@ int rr_update_parent(const knot_rrset_t *rr, unsigned hint, struct kr_layer_para int rr_update_answer(const knot_rrset_t *rr, unsigned hint, struct kr_layer_param *param) { knot_pkt_t *answer = param->answer; - + /* Write copied RR to the result packet. */ int ret = knot_pkt_put(answer, KNOT_COMPR_HINT_NONE, rr, hint); if (ret != KNOT_EOK) { @@ -176,7 +176,7 @@ static bool has_glue(const knot_dname_t *ns_name, knot_pkt_t *pkt) const knot_rrset_t *rr = knot_pkt_rr(ar, i); if ((rr->type == KNOT_RRTYPE_A || rr->type == KNOT_RRTYPE_AAAA) && (knot_dname_is_equal(ns_name, rr->owner))) { - return true; + return true; } } return false; @@ -372,7 +372,7 @@ static int prepare_query(knot_layer_t *ctx, knot_pkt_t *pkt) query->id = dnssec_random_uint16_t(); knot_wire_set_id(pkt->wire, query->id); - + /* Declare EDNS0 support. */ knot_rrset_t opt_rr; ret = knot_edns_init(&opt_rr, KR_EDNS_PAYLOAD, 0, KR_EDNS_VERSION, &pkt->mm); diff --git a/lib/layer/itercache.c b/lib/layer/itercache.c index 91181c0c9..edf363c70 100644 --- a/lib/layer/itercache.c +++ b/lib/layer/itercache.c @@ -50,7 +50,7 @@ static int update_answer(const knot_rrset_t *rr, unsigned drift, struct kr_layer if (rr_copy.rrs.rr_count == 0) { return KNOT_STATE_FAIL; } - + return rr_update_answer(&rr_copy, 0, param); } diff --git a/lib/module.c b/lib/module.c index 4d6d81807..08ed61387 100644 --- a/lib/module.c +++ b/lib/module.c @@ -19,20 +19,20 @@ /** Check ABI version, return error on mismatch. */ #define ABI_CHECK(m, prefix, symname, required) do { \ if ((m)->lib != RTLD_DEFAULT) { \ - module_api_cb *_api = NULL; \ - *(void **) (&_api) = load_symbol((m)->lib, (prefix), (symname)); \ - if (_api == NULL) { \ - return kr_error(ENOENT); \ - } \ - if (_api() != (required)) { \ - return kr_error(ENOTSUP); \ - } \ - }\ - } while (0) - -/** Load ABI by symbol names. */ + module_api_cb *_api = NULL; \ + *(void **) (&_api) = load_symbol((m)->lib, (prefix), (symname)); \ + if (_api == NULL) { \ + return kr_error(ENOENT); \ + } \ + if (_api() != (required)) { \ + return kr_error(ENOTSUP); \ + } \ + }\ +} while (0) + +/** Load ABI by symbol names. */ #define ABI_LOAD(m, prefix, s_init, s_deinit, s_config, s_layer, s_prop) do { \ - module_prop_cb *module_prop = NULL; \ + module_prop_cb *module_prop = NULL; \ *(void **) (&(m)->init) = load_symbol((m)->lib, (prefix), (s_init)); \ *(void **) (&(m)->deinit) = load_symbol((m)->lib, (prefix), (s_deinit)); \ *(void **) (&(m)->config) = load_symbol((m)->lib, (prefix), (s_config)); \ @@ -76,9 +76,9 @@ static int load_library(struct kr_module *module, const char *name, const char * /** Load C module symbols. */ static int load_sym_c(struct kr_module *module, uint32_t api_required) { - auto_free char *module_prefix = kr_strcatdup(2, module->name, "_"); - ABI_CHECK(module, module_prefix, "api", api_required); - ABI_LOAD(module, module_prefix, "init", "deinit", "config", "layer", "props"); + auto_free char *module_prefix = kr_strcatdup(2, module->name, "_"); + ABI_CHECK(module, module_prefix, "api", api_required); + ABI_LOAD(module, module_prefix, "init", "deinit", "config", "layer", "props"); return kr_ok(); } @@ -114,7 +114,7 @@ static int bootstrap_libgo(struct kr_module *module) return kr_ok(); } -/** Load Go module symbols. */ +/** Load Go module symbols. */ static int load_ffi_go(struct kr_module *module, uint32_t api_required) { /* Bootstrap libgo */ @@ -149,7 +149,7 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path) auto_free char *local_path = kr_strcatdup(2, getenv("HOME"), "/.local" MODULEDIR); if (load_library(module, name, local_path) != 0) { if (load_library(module, name, PREFIX MODULEDIR) != 0) { - module->lib = RTLD_DEFAULT; + module->lib = RTLD_DEFAULT; } } } @@ -168,7 +168,6 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path) kr_module_unload(module); } - return ret; } diff --git a/lib/module.h b/lib/module.h index 575fd973f..40dc27bb5 100644 --- a/lib/module.h +++ b/lib/module.h @@ -15,7 +15,7 @@ */ /** \addtogroup modules - * @{ + * @{ */ #pragma once @@ -73,7 +73,7 @@ struct kr_module { /** * Load module instance into memory. - * + * * @param module module structure * @param name module name * @param path module search path @@ -83,14 +83,14 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path) /** * Unload module instance. - * + * * @param module module structure */ void kr_module_unload(struct kr_module *module); /** * Export module API version (place this at the end of your module). - * + * * @param module module name (f.e. hints) */ #define KR_MODULE_EXPORT(module) \ diff --git a/lib/nsrep.c b/lib/nsrep.c index bc19c28c1..2a3f2fbdb 100644 --- a/lib/nsrep.c +++ b/lib/nsrep.c @@ -4,4 +4,4 @@ int kr_nsrep_score(const knot_dname_t *ns, struct kr_layer_param *param) { /* TODO: stub, always returns valid */ return KR_NS_VALID; -} \ No newline at end of file +} diff --git a/lib/nsrep.h b/lib/nsrep.h index 9a5641c1f..922912a8d 100644 --- a/lib/nsrep.h +++ b/lib/nsrep.h @@ -15,7 +15,7 @@ */ /** \addtogroup nameservers - * @{ + * @{ */ #pragma once diff --git a/lib/resolve.c b/lib/resolve.c old mode 100755 new mode 100644 index 5b62364f2..c836908a8 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -39,7 +39,7 @@ static int invalidate_ns(struct kr_rplan *rplan, struct kr_query *qry) if (txn == NULL) { return KNOT_EOK; } - + /* Fetch current nameserver cache. */ uint32_t drift = qry->timestamp.tv_sec; knot_rrset_t cached; @@ -49,7 +49,7 @@ static int invalidate_ns(struct kr_rplan *rplan, struct kr_query *qry) return KNOT_EOK; } cached = kr_cache_materialize(&cached, drift, rplan->pool); - + /* Find a matching RD. */ knot_rdataset_t to_remove; knot_rdataset_init(&to_remove); @@ -61,7 +61,7 @@ static int invalidate_ns(struct kr_rplan *rplan, struct kr_query *qry) } knot_rdataset_subtract(&cached.rrs, &to_remove, rplan->pool); knot_rdataset_clear(&to_remove, rplan->pool); - + /* Remove record(s) */ int ret = KNOT_EOK; if (cached.rrs.rr_count == 0) { @@ -78,7 +78,7 @@ static int invalidate_ns(struct kr_rplan *rplan, struct kr_query *qry) static int ns_resolve_addr(struct kr_query *cur, struct kr_layer_param *param) { - if (kr_rplan_satisfies(cur, cur->zone_cut.ns, KNOT_CLASS_IN, KNOT_RRTYPE_A) || + if (kr_rplan_satisfies(cur, cur->zone_cut.ns, KNOT_CLASS_IN, KNOT_RRTYPE_A) || kr_rplan_satisfies(cur, cur->zone_cut.ns, KNOT_CLASS_IN, KNOT_RRTYPE_AAAA)) { DEBUG_MSG("=> dependency loop, bailing out\n"); kr_rplan_pop(param->rplan, cur); diff --git a/lib/resolve.h b/lib/resolve.h index 913bcc55c..7319c246e 100644 --- a/lib/resolve.h +++ b/lib/resolve.h @@ -15,7 +15,7 @@ */ /** \addtogroup resolution - * @{ + * @{ */ #pragma once diff --git a/lib/rplan.h b/lib/rplan.h index 5c40a182f..8008dfd25 100644 --- a/lib/rplan.h +++ b/lib/rplan.h @@ -15,7 +15,7 @@ */ /** \addtogroup rplan - * @{ + * @{ */ #pragma once diff --git a/lib/utils.c b/lib/utils.c index 5f3c60355..1d79fb417 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -2,6 +2,7 @@ #include #include #include + #include "lib/defines.h" #include "lib/utils.h" @@ -15,49 +16,49 @@ */ void _cleanup_free(char **p) { - free(*p); + free(*p); } void _cleanup_close(int *p) { - if (*p > 0) close(*p); + if (*p > 0) close(*p); } void _cleanup_fclose(FILE **p) { - if (*p) fclose(*p); + if (*p) fclose(*p); } char* kr_strcatdup(unsigned n, ...) { - /* Calculate total length */ - size_t total_len = 0; - va_list vl; - va_start(vl, n); - for (unsigned i = 0; i < n; ++i) { - char *item = va_arg(vl, char *); - total_len += strlen_safe(item); - } - va_end(vl); - - /* Allocate result and fill */ - char *result = NULL; - if (total_len > 0) { - result = malloc(total_len + 1); - } - if (result) { - char *stream = result; - va_start(vl, n); - for (unsigned i = 0; i < n; ++i) { - char *item = va_arg(vl, char *); - if (item) { - size_t len = strlen(item); - memcpy(stream, item, len + 1); - stream += len; - } - } - va_end(vl); - } - - return result; -} \ No newline at end of file + /* Calculate total length */ + size_t total_len = 0; + va_list vl; + va_start(vl, n); + for (unsigned i = 0; i < n; ++i) { + char *item = va_arg(vl, char *); + total_len += strlen_safe(item); + } + va_end(vl); + + /* Allocate result and fill */ + char *result = NULL; + if (total_len > 0) { + result = malloc(total_len + 1); + } + if (result) { + char *stream = result; + va_start(vl, n); + for (unsigned i = 0; i < n; ++i) { + char *item = va_arg(vl, char *); + if (item) { + size_t len = strlen(item); + memcpy(stream, item, len + 1); + stream += len; + } + } + va_end(vl); + } + + return result; +} diff --git a/lib/utils.h b/lib/utils.h index 0ad06a4f6..215261dcc 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -15,7 +15,7 @@ */ /** \addtogroup utils - * @{ + * @{ */ #pragma once diff --git a/lib/zonecut.c b/lib/zonecut.c index efbab766b..2f9e12d5e 100644 --- a/lib/zonecut.c +++ b/lib/zonecut.c @@ -137,7 +137,7 @@ static int fetch_ns(struct kr_zonecut *cut, const knot_dname_t *name, namedb_txn if (ret != KNOT_EOK) { return ret; } - + /* Accept only if has address records cached. */ for (unsigned i = 0; i < cached_rr.rrs.rr_count; ++i) { kr_set_zone_cut(cut, name, knot_ns_name(&cached_rr.rrs, i)); diff --git a/lib/zonecut.h b/lib/zonecut.h index 90a07981d..0af033a6f 100644 --- a/lib/zonecut.h +++ b/lib/zonecut.h @@ -15,7 +15,7 @@ */ /** \addtogroup rplan - * @{ + * @{ */ #pragma once diff --git a/modules/cachectl/cachectl.c b/modules/cachectl/cachectl.c index 97041da3a..59290311e 100644 --- a/modules/cachectl/cachectl.c +++ b/modules/cachectl/cachectl.c @@ -40,7 +40,7 @@ * * Input: N/A * Output: { size: int } - * + * */ static char* get_size(void *env, struct kr_module *module, const char *args) { @@ -57,7 +57,7 @@ static char* get_size(void *env, struct kr_module *module, const char *args) } else { asprintf(&result, "{ \"error\": \"%s\" }", knot_strerror(ret)); } - + return result; } @@ -84,7 +84,7 @@ static int is_expired(struct kr_cache_rrset *rr, uint32_t drift) * * Input: N/A * Output: { pruned: int } - * + * */ static char* prune(void *env, struct kr_module *module, const char *args) { @@ -124,7 +124,7 @@ static char* prune(void *env, struct kr_module *module, const char *args) } else { asprintf(&result, "{ \"pruned\": %d }", pruned); } - + return result; } @@ -133,7 +133,7 @@ static char* prune(void *env, struct kr_module *module, const char *args) * * Input: N/A * Output: { result: bool } - * + * */ static char* clear(void *env, struct kr_module *module, const char *args) { @@ -164,13 +164,13 @@ static char* clear(void *env, struct kr_module *module, const char *args) struct kr_prop *cachectl_props(void) { - static struct kr_prop prop_list[] = { - { &get_size, "size", "Return number of cached records.", }, - { &prune, "prune", "Prune expired/invalid records.", }, - { &clear, "clear", "Clear all cache records.", }, - { NULL, NULL, NULL } - }; - return prop_list; + static struct kr_prop prop_list[] = { + { &get_size, "size", "Return number of cached records.", }, + { &prune, "prune", "Prune expired/invalid records.", }, + { &clear, "clear", "Clear all cache records.", }, + { NULL, NULL, NULL } + }; + return prop_list; } KR_MODULE_EXPORT(cachectl); diff --git a/modules/hints/hints.c b/modules/hints/hints.c index fbcfd87ba..e0c95f5e8 100644 --- a/modules/hints/hints.c +++ b/modules/hints/hints.c @@ -31,7 +31,7 @@ /* TODO: this is an experimental (slow) proof-of-concept, * this will be rewritten with namedb API - */ + */ typedef int (*rr_callback_t)(const knot_rrset_t *, unsigned, struct kr_layer_param *); @@ -89,7 +89,7 @@ static int query(knot_layer_t *ctx, knot_pkt_t *pkt) knot_rrset_t rr; knot_rrset_init(&rr, pair->name, qtype, KNOT_CLASS_IN); struct sockaddr_storage addr; - sockaddr_set(&addr, addr_type, pair->addr, 0); + sockaddr_set(&addr, addr_type, pair->addr, 0); size_t addr_len = 0; uint8_t *raw_addr = sockaddr_raw(&addr, &addr_len); knot_rrset_add_rdata(&rr, raw_addr, addr_len, 0, ¶m->answer->mm); @@ -135,7 +135,7 @@ static int load_map(struct hint_map *map, FILE *fp) if (pair->addr == NULL) { return kr_error(ENOMEM); } - + strcpy(pair->addr, tok); add_tail(&map->list, &pair->n); name_tok = strtok_r(NULL, " \t\n", &saveptr); diff --git a/tests/test_cache.c b/tests/test_cache.c index e8015d5d7..86e792675 100644 --- a/tests/test_cache.c +++ b/tests/test_cache.c @@ -26,7 +26,7 @@ knot_rrset_t global_rr; const char *global_env; #define CACHE_SIZE 10 * 4096 -#define CACHE_TTL 2 +#define CACHE_TTL 2 /* Test invalid parameters. */ static void test_invalid(void **state) diff --git a/tests/test_integration.c b/tests/test_integration.c index 2fb7c8063..33b7a999d 100644 --- a/tests/test_integration.c +++ b/tests/test_integration.c @@ -64,7 +64,7 @@ static PyObject* init(PyObject* self, PyObject* args) memset(&global_context, 0, sizeof(struct kr_context)); global_context.pool = &global_mm; global_context.modules = &global_modules; - + global_tmpdir = test_tmpdir_create(); assert(global_tmpdir); global_context.cache = kr_cache_open(global_tmpdir, &global_mm, 100 * 4096); @@ -72,7 +72,7 @@ static PyObject* init(PyObject* self, PyObject* args) /* No configuration parsing support yet. */ if (strstr(config, "query-minimization: on") == NULL) { - global_context.options |= QUERY_NO_MINIMIZE; + global_context.options |= QUERY_NO_MINIMIZE; } return Py_BuildValue(""); diff --git a/tests/test_rplan.c b/tests/test_rplan.c index e1f53c359..f25bc9ba1 100644 --- a/tests/test_rplan.c +++ b/tests/test_rplan.c @@ -30,7 +30,7 @@ static void test_rplan_params(void **state) assert_null(kr_rplan_txn_acquire(NULL, 0)); assert_int_equal(kr_rplan_txn_commit(NULL), KNOT_EINVAL); kr_rplan_deinit(NULL); - + /* NULL mandatory parameters */ struct kr_rplan rplan;