public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, /
Date: Tue, 24 Feb 2015 01:26:04 +0000 (UTC)	[thread overview]
Message-ID: <1424634014.373a921bffef672d0fd9da62dcbca18330a838b8.vapier@gentoo> (raw)

commit:     373a921bffef672d0fd9da62dcbca18330a838b8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 22 19:38:49 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> 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)


             reply	other threads:[~2015-02-24  1:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  1:26 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-28  2:44 [gentoo-commits] proj/portage-utils:master commit in: libq/, / Mike Frysinger
2016-11-26 23:17 Mike Frysinger
2016-12-29  2:25 Mike Frysinger
2018-03-23 11:56 Fabian Groffen
2019-03-09 18:58 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-22  9:57 Fabian Groffen
2019-03-27 10:55 Fabian Groffen
2019-03-27 20:18 Fabian Groffen
2019-04-28 15:20 Fabian Groffen
2019-05-05 18:13 Fabian Groffen
2019-05-09 20:19 Fabian Groffen
2019-06-05  9:15 Fabian Groffen
2019-06-19 10:44 Fabian Groffen
2019-07-13 10:04 Fabian Groffen
2019-12-27 16:57 Fabian Groffen
2019-12-29 13:26 Fabian Groffen
2019-12-30 17:24 Fabian Groffen
2019-12-31  9:05 Fabian Groffen
2020-01-01 19:52 Fabian Groffen
2020-01-02 11:19 Fabian Groffen
2020-01-05 13:28 Fabian Groffen
2020-02-21  8:18 Fabian Groffen
2021-08-16 13:23 Fabian Groffen
2023-02-07  8:10 Fabian Groffen
2023-02-07  8:25 Fabian Groffen
2024-01-02  7:57 Fabian Groffen
2024-03-29 10:57 Fabian Groffen
2024-06-27 19:19 Fabian Groffen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424634014.373a921bffef672d0fd9da62dcbca18330a838b8.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox