From: Timo Sirainen Date: Tue, 24 Mar 2020 10:24:01 +0000 (+0200) Subject: stats, fts-solr: Tweak unit tests to make static analyzers happier X-Git-Tag: 2.3.11.2~511 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48e65c011d5debe8f50dd65468ac1c0134b5b232;p=thirdparty%2Fdovecot%2Fcore.git stats, fts-solr: Tweak unit tests to make static analyzers happier --- diff --git a/src/plugins/fts-solr/test-solr-response.c b/src/plugins/fts-solr/test-solr-response.c index 6ddeb48c3c..8add6db144 100644 --- a/src/plugins/fts-solr/test-solr-response.c +++ b/src/plugins/fts-solr/test-solr-response.c @@ -156,7 +156,7 @@ test_solr_result(const struct solr_response_test_result *test_results, if (test_has_failed()) return; - for (i = 0; i < rcount; i++) { + for (i = 0; i < rcount && parse_results[i] != NULL; i++) { unsigned int scount, j; const struct fts_score_map *tscores = test_results[i].scores; const struct fts_score_map *pscores = diff --git a/src/stats/test-stats-metrics.c b/src/stats/test-stats-metrics.c index 380c49b229..c255b77333 100644 --- a/src/stats/test-stats-metrics.c +++ b/src/stats/test-stats-metrics.c @@ -117,7 +117,7 @@ static void test_stats_metrics_group_by_check_one(const struct metric *metric, if (group_by_count > 0) { test_assert(metric->group_by_count == group_by_count); - test_assert(metric->group_by != NULL); + i_assert(metric->group_by != NULL); test_assert(metric->group_by[0].func == group_by_func); test_assert_strcmp(metric->group_by[0].field, group_by_field); } else {