mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-14 19:57:31 +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;
|
return;
|
||||||
|
|
||||||
compact:
|
compact:
|
||||||
new->id->value = new->more;
|
new->id->jrb->val = new->more;
|
||||||
old->installed = old->installed || new->installed;
|
old->installed = old->installed || new->installed;
|
||||||
/* @@@ we may leak a little */
|
/* @@@ we may leak a little */
|
||||||
free(new);
|
free(new);
|
||||||
@ -264,8 +264,8 @@ package:
|
|||||||
WHITESPACE;
|
WHITESPACE;
|
||||||
pkg = alloc_type(struct pkg);
|
pkg = alloc_type(struct pkg);
|
||||||
pkg->id = ID(packages);
|
pkg->id = ID(packages);
|
||||||
pkg->more = pkg->id->value;
|
pkg->more = pkg->id->jrb->val;
|
||||||
pkg->id->value = pkg;
|
pkg->id->jrb->val = pkg;
|
||||||
pkg->version = NULL;
|
pkg->version = NULL;
|
||||||
pkg->conflicts = pkg->depends = NULL;
|
pkg->conflicts = pkg->depends = NULL;
|
||||||
pkg->filename = 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 = free_id;
|
||||||
id->s = s;
|
id->s = s;
|
||||||
id->len = len;
|
id->len = len;
|
||||||
id->value = NULL;
|
|
||||||
node = jrb_find(tree->root, id, tree->comp);
|
node = jrb_find(tree->root, id, tree->comp);
|
||||||
if (node)
|
if (node)
|
||||||
return node->key;
|
return node->key;
|
||||||
|
@ -17,7 +17,6 @@ struct id {
|
|||||||
struct jrb *jrb;
|
struct jrb *jrb;
|
||||||
const char *s;
|
const char *s;
|
||||||
size_t len;
|
size_t len;
|
||||||
void *value;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ static int level = 0;
|
|||||||
dep = next_dep->refs;
|
dep = next_dep->refs;
|
||||||
next_dep = next_dep->next;
|
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)
|
if (best && n_stack == n_best)
|
||||||
return;
|
return;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -17,7 +17,7 @@ static void list_all_packages(void)
|
|||||||
const struct id *id;
|
const struct id *id;
|
||||||
|
|
||||||
for (id = first_id(packages); id; id = next_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);
|
printf("%.*s", (int) id->len, id->s);
|
||||||
if (!pkg)
|
if (!pkg)
|
||||||
@ -43,7 +43,7 @@ static void list_one_package(const char *name)
|
|||||||
fprintf(stderr, "no such package \"%s\"\n", name);
|
fprintf(stderr, "no such package \"%s\"\n", name);
|
||||||
exit(1);
|
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);
|
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);
|
fprintf(stderr, "no such package \"%s\"\n", name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
pkg = id->value;
|
pkg = id->jrb->val;
|
||||||
if (!pkg) {
|
if (!pkg) {
|
||||||
fprintf(stderr, "package %s is a ghost\n", name);
|
fprintf(stderr, "package %s is a ghost\n", name);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user