summaryrefslogtreecommitdiffstats
path: root/modules/dnstap
diff options
context:
space:
mode:
authorTomas Krizek <tomas.krizek@nic.cz>2021-05-25 14:17:23 +0200
committerTomas Krizek <tomas.krizek@nic.cz>2021-05-25 14:40:30 +0200
commit2bc7b1e51318dc882c1f84073e9880cb77570bf7 (patch)
treece932523c65e0997d5291e90083b976d80f59896 /modules/dnstap
parentlib/dnssec/ta.c: replace asserts (diff)
downloadknot-resolver-2bc7b1e51318dc882c1f84073e9880cb77570bf7.tar.xz
knot-resolver-2bc7b1e51318dc882c1f84073e9880cb77570bf7.zip
treewide: rename assumptions to kr_assert() / kr_fails_assert()
To (hopefully) improve readability, rename the typical macro usage of: if (!kr_assume(x)) y; // to if (kr_fails_assert(x)) y; As a convenience, replace the assert without a return value to a more simple version: (void)!kr_assume(x); // becomes kr_assert(x);
Diffstat (limited to 'modules/dnstap')
-rw-r--r--modules/dnstap/dnstap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c
index 73e8df7d..f813653b 100644
--- a/modules/dnstap/dnstap.c
+++ b/modules/dnstap/dnstap.c
@@ -110,7 +110,7 @@ static void set_address(const struct sockaddr *sockaddr,
/** Fill a tcp_info or return kr_error(). */
static int get_tcp_info(const struct kr_request *req, struct tcp_info *info)
{
- if(!kr_assume(req && info))
+ if(kr_fails_assert(req && info))
return kr_error(EINVAL);
if (!req->qsource.dst_addr || !req->qsource.flags.tcp) /* not TCP-based */
return -abs(ENOENT);
@@ -383,10 +383,10 @@ static struct fstrm_writer* dnstap_unix_writer(const char *path) {
static int find_string(const JsonNode *node, char **val, size_t len) {
if (!node || !node->key)
return kr_error(EINVAL);
- if (!kr_assume(node->tag == JSON_STRING))
+ if (kr_fails_assert(node->tag == JSON_STRING))
return kr_error(EINVAL);
*val = strndup(node->string_, len);
- if (!kr_assume(*val != NULL))
+ if (kr_fails_assert(*val != NULL))
return kr_error(errno);
return kr_ok();
}
@@ -395,7 +395,7 @@ static int find_string(const JsonNode *node, char **val, size_t len) {
static bool find_bool(const JsonNode *node) {
if (!node || !node->key)
return false;
- if (!kr_assume(node->tag == JSON_BOOL))
+ if (kr_fails_assert(node->tag == JSON_BOOL))
return false;
return node->bool_;
}