From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1A15E138AD7 for ; Tue, 24 Feb 2015 01:26:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4689CE08D4; Tue, 24 Feb 2015 01:26:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CD032E08D4 for ; Tue, 24 Feb 2015 01:26:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C41F834095F for ; Tue, 24 Feb 2015 01:26:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C4CE8126B8 for ; Tue, 24 Feb 2015 01:26:04 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1424634014.373a921bffef672d0fd9da62dcbca18330a838b8.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, / X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/virtuals.c main.c qlist.c qmerge.c qpkg.c qsize.c X-VCS-Directories: / libq/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 373a921bffef672d0fd9da62dcbca18330a838b8 X-VCS-Branch: master Date: Tue, 24 Feb 2015 01:26:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8d3036aa-2f1f-4a0d-94e8-e0d3a8e0ef53 X-Archives-Hash: ee6f08d80246686da6515141e22d323a commit: 373a921bffef672d0fd9da62dcbca18330a838b8 Author: Mike Frysinger gentoo org> AuthorDate: Sun Feb 22 19:38:49 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sun Feb 22 19:40:14 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=373a921b drop unused "item" member of set logic This was nominally used by qmerge to hold the SLOT, but we're scrapping that in favor of proper atoms, so unwind the item entirely. --- libq/virtuals.c | 52 +++++++--------------------------------------------- main.c | 2 +- qlist.c | 2 +- qmerge.c | 38 ++++++-------------------------------- qpkg.c | 2 +- qsize.c | 2 +- 6 files changed, 17 insertions(+), 81 deletions(-) diff --git a/libq/virtuals.c b/libq/virtuals.c index 18663e0..536c622 100644 --- a/libq/virtuals.c +++ b/libq/virtuals.c @@ -14,7 +14,6 @@ /* used to queue a lot of things */ struct queue_t { char *name; - char *item; struct queue_t *next; }; @@ -38,47 +37,13 @@ append_set(queue *q, queue *ll) /* add a set to a cache */ _q_static queue * -add_set(const char *vv, const char *ss, queue *q) +add_set(const char *name, queue *q) { - queue *ll; - char *s, *ptr; - char *v, *vptr; - - s = xstrdup(ss); - v = xstrdup(vv); - ptr = xmalloc(strlen(ss)); - vptr = xmalloc(strlen(vv)); - - do { - *ptr = 0; - *vptr = 0; - rmspace(ptr); - rmspace(s); - rmspace(vptr); - rmspace(v); - - ll = xmalloc(sizeof(queue)); - ll->next = NULL; - ll->name = xmalloc(strlen(v) + 1); - ll->item = xmalloc(strlen(s) + 1); - strcpy(ll->item, s); - strcpy(ll->name, v); - - q = append_set(q, ll); - - *v = 0; - strcpy(v, vptr); - *s = 0; - strcpy(s, ptr); - - } while (v[0]); - - free(s); - free(ptr); - free(v); - free(vptr); - - return q; + queue *ll = xmalloc(sizeof(*ll)); + ll->next = NULL; + ll->name = xstrdup(name); + rmspace(ll->name); + return append_set(q, ll); } /* remove a set from a cache. matches ->name and frees name,item */ @@ -96,14 +61,12 @@ del_set(char *s, queue *q, int *ok) if (ll == list) { list = (ll->next); free(ll->name); - free(ll->item); free(ll); ll = list; } else { old->next = ll->next; free(ll->name); - free(ll->item); free(ll); ll = old->next; } @@ -125,7 +88,6 @@ free_sets(queue *list) while (ll != NULL) { q = ll->next; free(ll->name); - free(ll->item); free(ll); ll = q; } @@ -136,5 +98,5 @@ void print_sets(const queue *list) { const queue *ll; for (ll = list; ll != NULL; ll = ll->next) - printf("%s -> %s\n", ll->name, ll->item); + puts(ll->name); } diff --git a/main.c b/main.c index c06cf49..1ee8816 100644 --- a/main.c +++ b/main.c @@ -1290,7 +1290,7 @@ _q_static queue *get_vdb_atoms(int fullcpv) snprintf(buf, sizeof(buf), "%s/%s", atom->CATEGORY, atom->PN); } atom_implode(atom); - cpf = add_set(buf, slot, cpf); + cpf = add_set(buf, cpf); } scandir_free(pf, dfd); } diff --git a/qlist.c b/qlist.c index cccea33..d17ba5e 100644 --- a/qlist.c +++ b/qlist.c @@ -86,7 +86,7 @@ static char *grab_pkg_umap(q_vdb_pkg_ctx *pkg_ctx) for (i = 1; i < use_argc; i++) { int ok = 0; sets = del_set(use_argv[i], sets, &ok); - sets = add_set(use_argv[i], use_argv[i], sets); + sets = add_set(use_argv[i], sets); } umap[0] = '\0'; /* reset the buffer */ for (ll = sets; ll != NULL; ll = ll->next) { diff --git a/qmerge.c b/qmerge.c index b2ef9a7..7556b4b 100644 --- a/qmerge.c +++ b/qmerge.c @@ -567,7 +567,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst, #if 0 /* We filter out "dir" as it's generally unnecessary cruft */ /* syntax: dir dirname */ fprintf(contents, "dir %s\n", cpath); - *objs = add_set(cpath, "", *objs); + *objs = add_set(cpath, *objs); qprintf("%s>>>%s %s%s%s/\n", GREEN, NORM, DKBLUE, cpath, NORM); #endif @@ -614,7 +614,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst, dname = name; qprintf("%s>>>%s %s\n", GREEN, NORM, cpath); } - *objs = add_set(cpath, "", *objs); + *objs = add_set(cpath, *objs); /* First try fast path -- src/dst are same device */ if (renameat(subfd_src, dname, subfd_dst, name) == 0) @@ -690,7 +690,7 @@ merge_tree_at(int fd_src, const char *src, int fd_dst, const char *dst, /* syntax: sym src -> dst mtime */ fprintf(contents, "sym %s -> %s %"PRIu64"u\n", cpath, sym, (uint64_t)st.st_mtime); qprintf("%s>>>%s %s%s -> %s%s\n", GREEN, NORM, CYAN, cpath, sym, NORM); - *objs = add_set(cpath, "", *objs); + *objs = add_set(cpath, *objs); /* Make it in the dest tree */ if (symlinkat(sym, subfd_dst, name)) { @@ -1241,15 +1241,6 @@ _q_static int match_pkg(queue *ll, const struct pkg_t *pkg) if (match) goto match_done; - if (ll->item) { - depend_atom *subatom = atom_explode(ll->name); - if (subatom == NULL) - goto match_done; - if (strcmp(atom->PN, subatom->PN) == 0) - match = 1; - atom_implode(subatom); - } - match_done: atom_implode(atom); @@ -1809,23 +1800,6 @@ parse_packages(queue *todo) } _q_static queue * -qmerge_add_set_atom(char *satom, queue *set) -{ - char *p; - const char *slot = ""; - - if (!uninstall) { - if ((p = strchr(satom, ':')) != NULL) { - *p = 0; - slot = p + 1; - } else - slot = "0"; - } - - return add_set(satom, slot, set); -} - -_q_static queue * qmerge_add_set_file(const char *dir, const char *file, queue *set) { FILE *fp; @@ -1846,7 +1820,7 @@ qmerge_add_set_file(const char *dir, const char *file, queue *set) buf = NULL; while (getline(&buf, &buflen, fp) != -1) { rmspace(buf); - set = qmerge_add_set_atom(buf, set); + set = add_set(buf, set); } free(buf); @@ -1868,7 +1842,7 @@ qmerge_add_set_system(void *data, char *buf) s = buf; if (*s == '*') - set = add_set(s + 1, "", set); + set = add_set(s + 1, set); else if (s[0] == '-' && s[1] == '*') { int ok; set = del_set(s + 2, set, &ok); @@ -1892,7 +1866,7 @@ qmerge_add_set(char *buf, queue *set) else if (buf[0] == '@') return qmerge_add_set_file("/etc/portage", buf+1, set); else - return qmerge_add_set_atom(buf, set); + return add_set(buf, set); } _q_static int diff --git a/qpkg.c b/qpkg.c index 4a5d9fd..5b63ec2 100644 --- a/qpkg.c +++ b/qpkg.c @@ -157,7 +157,7 @@ int qpkg_clean(char *dirp) /* num_all_bytes will be off when pretend and eclean are enabled together */ /* vdb = del_set(buf, vdb, &i); */ - vdb = add_set(buf, "0", vdb); + vdb = add_set(buf, vdb); } free(buf); diff --git a/qsize.c b/qsize.c index 83ad8b1..486edcf 100644 --- a/qsize.c +++ b/qsize.c @@ -65,7 +65,7 @@ int qsize_main(int argc, char **argv) case 'm': disp_units = MEGABYTE; str_disp_units = "MiB"; break; case 'k': disp_units = KILOBYTE; str_disp_units = "KiB"; break; case 'b': disp_units = 1; str_disp_units = "bytes"; break; - case 'i': ignore_regexp = add_set(optarg, optarg, ignore_regexp); break; + case 'i': ignore_regexp = add_set(optarg, ignore_regexp); break; } } if ((argc == optind) && !search_all)