aboutsummaryrefslogtreecommitdiff
path: root/libq
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2023-02-07 09:24:21 +0100
committerFabian Groffen <grobian@gentoo.org>2023-02-07 09:24:21 +0100
commit067af6b9098858e786e71ef20cb91ad75c6e4ba4 (patch)
treee619fe97120b66558c0d312a68750ddbd05e3510 /libq
parentset: ensure NULL is empty behaviour is retained throughout (diff)
downloadportage-utils-067af6b9098858e786e71ef20cb91ad75c6e4ba4.tar.gz
portage-utils-067af6b9098858e786e71ef20cb91ad75c6e4ba4.tar.bz2
portage-utils-067af6b9098858e786e71ef20cb91ad75c6e4ba4.zip
set: try to silence Coverity
Now add_set_value can allocate a new set, Coverity thinks this will actually happen, despite in these cases the input set not being NULL. Help Coverity by adding a redundant if. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'libq')
-rw-r--r--libq/tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libq/tree.c b/libq/tree.c
index a05a86e2..f308c8d7 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1709,7 +1709,8 @@ tree_match_atom_cache_populate_cb(tree_pkg_ctx *ctx, void *priv)
cat_ctx = get_set(atom->CATEGORY, cache);
if (cat_ctx == NULL) {
cat_ctx = tree_open_cat(tctx, ".");
- cache = add_set_value(atom->CATEGORY, cat_ctx, NULL, cache);
+ if (cache != NULL) /* for static code analysers */
+ add_set_value(atom->CATEGORY, cat_ctx, NULL, cache);
/* get a pointer from the set */
cat_ctx->name = contains_set(atom->CATEGORY, cache);
}