aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2023-02-07 09:08:13 +0100
committerFabian Groffen <grobian@gentoo.org>2023-02-07 09:08:13 +0100
commite2ebb44db31d4e0e9bfc0a9974d36eff63c8b2b1 (patch)
tree992157f1f78251bd617bf445c6b818a2314440dd /main.c
parentqmerge: add some braindump notes about how things could be (diff)
downloadportage-utils-e2ebb44db31d4e0e9bfc0a9974d36eff63c8b2b1.tar.gz
portage-utils-e2ebb44db31d4e0e9bfc0a9974d36eff63c8b2b1.tar.bz2
portage-utils-e2ebb44db31d4e0e9bfc0a9974d36eff63c8b2b1.zip
set: ensure NULL is empty behaviour is retained throughout
Not all set functions respected NULL is empty behaviour, changed add_set_value signature to return a set instead so it can conform. Bug: https://bugs.gentoo.org/893424 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c
index 347a50b..c5b27fe 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2022 Gentoo Foundation
+ * Copyright 2005-2023 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
*
* Copyright 2005-2008 Ned Ludd - <solar@gentoo.org>
@@ -581,10 +581,12 @@ read_portage_file(const char *file, enum portage_file_type type, void *data)
if ((p = del_set(buf + 1, masks, NULL)) != NULL)
free(p);
} else {
+ void *e;
snprintf(npath, sizeof(npath), "%s:%zu:%zu-%zu",
file, line, cbeg, cend);
p = xstrdup(npath);
- if (add_set_value(buf, p, masks) != NULL)
+ masks = add_set_value(buf, p, &e, masks);
+ if (e != NULL)
free(p);
}
}