mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-22 03:02:50 +02:00
qpkg: use "val" field of jrb nodes instead of keeping one in "struct id"
- id.h (struct id), id.c (make_id): remove field "value" - gobble.c (compact_pkg, gobble_buf), prereq.c (list_all_packages, list_one_package, find_prereq): use id->jrb->val instead of id->value
This commit is contained in:
parent
0cc1dfc938
commit
64c70e77f4
@ -81,7 +81,7 @@ static void compact_pkg(struct pkg *new)
|
||||
return;
|
||||
|
||||
compact:
|
||||
new->id->value = new->more;
|
||||
new->id->jrb->val = new->more;
|
||||
old->installed = old->installed || new->installed;
|
||||
/* @@@ we may leak a little */
|
||||
free(new);
|
||||
@ -264,8 +264,8 @@ package:
|
||||
WHITESPACE;
|
||||
pkg = alloc_type(struct pkg);
|
||||
pkg->id = ID(packages);
|
||||
pkg->more = pkg->id->value;
|
||||
pkg->id->value = pkg;
|
||||
pkg->more = pkg->id->jrb->val;
|
||||
pkg->id->jrb->val = pkg;
|
||||
pkg->version = NULL;
|
||||
pkg->conflicts = pkg->depends = NULL;
|
||||
pkg->filename = NULL;
|
||||
|
@ -45,7 +45,6 @@ struct id *make_id(struct tree *tree, const char *s, size_t len)
|
||||
id = free_id;
|
||||
id->s = s;
|
||||
id->len = len;
|
||||
id->value = NULL;
|
||||
node = jrb_find(tree->root, id, tree->comp);
|
||||
if (node)
|
||||
return node->key;
|
||||
|
@ -17,7 +17,6 @@ struct id {
|
||||
struct jrb *jrb;
|
||||
const char *s;
|
||||
size_t len;
|
||||
void *value;
|
||||
};
|
||||
|
||||
|
||||
|
@ -175,7 +175,7 @@ static int level = 0;
|
||||
dep = next_dep->refs;
|
||||
next_dep = next_dep->next;
|
||||
}
|
||||
for (pkg = dep->pkg->value; pkg; pkg = pkg->more) {
|
||||
for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
|
||||
if (best && n_stack == n_best)
|
||||
return;
|
||||
#if 0
|
||||
|
@ -17,7 +17,7 @@ static void list_all_packages(void)
|
||||
const struct id *id;
|
||||
|
||||
for (id = first_id(packages); id; id = next_id(id)) {
|
||||
struct pkg *pkg = id->value;
|
||||
struct pkg *pkg = id->jrb->val;
|
||||
|
||||
printf("%.*s", (int) id->len, id->s);
|
||||
if (!pkg)
|
||||
@ -43,7 +43,7 @@ static void list_one_package(const char *name)
|
||||
fprintf(stderr, "no such package \"%s\"\n", name);
|
||||
exit(1);
|
||||
}
|
||||
for (pkg = id->value; pkg; pkg = pkg->more)
|
||||
for (pkg = id->jrb->val; pkg; pkg = pkg->more)
|
||||
printf("%.*s\n", (int) pkg->version->len, pkg->version->s);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ static void find_prereq(const char *name, const char *version)
|
||||
fprintf(stderr, "no such package \"%s\"\n", name);
|
||||
exit(1);
|
||||
}
|
||||
pkg = id->value;
|
||||
pkg = id->jrb->val;
|
||||
if (!pkg) {
|
||||
fprintf(stderr, "package %s is a ghost\n", name);
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user