From: Tomas Krizek Date: Wed, 24 Mar 2021 16:44:48 +0000 (+0100) Subject: modules/stats/stats.c: replace asserts X-Git-Tag: v5.4.0~18^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93f353c281c9eac0fd530966c2adc4ddea544bf8;p=thirdparty%2Fknot-resolver.git modules/stats/stats.c: replace asserts --- diff --git a/modules/stats/stats.c b/modules/stats/stats.c index 54b7a87c4..c34c5abc8 100644 --- a/modules/stats/stats.c +++ b/modules/stats/stats.c @@ -132,10 +132,8 @@ static void collect_sample(struct stat_data *data, struct kr_rplan *rplan) * TODO: redesign the sampling approach. */ if (kr_rand_coin(1, FREQUENT_PSAMPLE)) { int key_len = collect_key(key, qry->sname, qry->stype); - if (key_len < 0) { - assert(false); + if (!kr_assume(key_len >= 0)) continue; - } unsigned *count = lru_get_new(data->queries.frequent, key, key_len, NULL); if (count) *count += 1;