diff options
author | Fabian Groffen <grobian@gentoo.org> | 2019-06-19 12:43:09 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2019-06-19 12:43:09 +0200 |
commit | 1089b8baedcd1d6d7aa41e8f5f81938660079e01 (patch) | |
tree | 1ca046aa8094fa2175985bdf0d121d19de2aa72b /qmerge.c | |
parent | TODO: drop implemented items (diff) | |
download | portage-utils-1089b8baedcd1d6d7aa41e8f5f81938660079e01.tar.gz portage-utils-1089b8baedcd1d6d7aa41e8f5f81938660079e01.tar.bz2 portage-utils-1089b8baedcd1d6d7aa41e8f5f81938660079e01.zip |
libq/set: drop rmspace for all inputsv0.80_pre20190620
Most of the times, rmspace is unnecessary, and doing so, requires a
mutable copy of the data. If the callers call rmspace when necessary,
set can be a bit more efficient.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'qmerge.c')
-rw-r--r-- | qmerge.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -2289,7 +2289,7 @@ parse_packages(set *todo) } static set * -qmerge_add_set_file(const char *dir, const char *file, set *q) +qmerge_add_set_file(const char *pfx, const char *dir, const char *file, set *q) { FILE *fp; int linelen; @@ -2297,7 +2297,7 @@ qmerge_add_set_file(const char *dir, const char *file, set *q) char *buf, *fname; /* Find the file to read */ - xasprintf(&fname, "%s%s/%s", portroot, dir, file); + xasprintf(&fname, "%s%s%s/%s", portroot, pfx, dir, file); if ((fp = fopen(fname, "r")) == NULL) { warnp("unable to read set file %s", fname); @@ -2348,15 +2348,19 @@ static set * qmerge_add_set(char *buf, set *q) { if (strcmp(buf, "world") == 0) - return qmerge_add_set_file("/var/lib/portage", "world", q); + return qmerge_add_set_file(CONFIG_EPREFIX, "/var/lib/portage", + "world", q); else if (strcmp(buf, "all") == 0) return tree_get_vdb_atoms(portroot, portvdb, 0); else if (strcmp(buf, "system") == 0) return q_profile_walk("packages", qmerge_add_set_system, q); else if (buf[0] == '@') - return qmerge_add_set_file("/etc/portage", buf+1, q); - else + /* TODO: use configroot */ + return qmerge_add_set_file(CONFIG_EPREFIX, "/etc/portage", buf+1, q); + else { + rmspace(buf); return add_set(buf, q); + } } static int |