Date:2010-11-20 02:02:42 (8 years 9 months ago)
Author:Werner Almesberger
Commit:64c70e77f4688090d806b77915395ed6c4b7d889
Message: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
Files: qpkg/gobble.c (2 diffs)
qpkg/id.c (1 diff)
qpkg/id.h (1 diff)
qpkg/prereq.c (1 diff)
qpkg/qpkg.c (3 diffs)

Change Details

qpkg/gobble.c
8181    return;
8282
8383compact:
84    new->id->value = new->more;
84    new->id->jrb->val = new->more;
8585    old->installed = old->installed || new->installed;
8686    /* @@@ we may leak a little */
8787    free(new);
...... 
264264    WHITESPACE;
265265    pkg = alloc_type(struct pkg);
266266    pkg->id = ID(packages);
267    pkg->more = pkg->id->value;
268    pkg->id->value = pkg;
267    pkg->more = pkg->id->jrb->val;
268    pkg->id->jrb->val = pkg;
269269    pkg->version = NULL;
270270    pkg->conflicts = pkg->depends = NULL;
271271    pkg->filename = NULL;
qpkg/id.c
4545    id = free_id;
4646    id->s = s;
4747    id->len = len;
48    id->value = NULL;
4948    node = jrb_find(tree->root, id, tree->comp);
5049    if (node)
5150        return node->key;
qpkg/id.h
1717    struct jrb *jrb;
1818    const char *s;
1919    size_t len;
20    void *value;
2120};
2221
2322
qpkg/prereq.c
175175        dep = next_dep->refs;
176176        next_dep = next_dep->next;
177177    }
178    for (pkg = dep->pkg->value; pkg; pkg = pkg->more) {
178    for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
179179        if (best && n_stack == n_best)
180180            return;
181181#if 0
qpkg/qpkg.c
1717    const struct id *id;
1818
1919    for (id = first_id(packages); id; id = next_id(id)) {
20        struct pkg *pkg = id->value;
20        struct pkg *pkg = id->jrb->val;
2121
2222        printf("%.*s", (int) id->len, id->s);
2323        if (!pkg)
...... 
4343        fprintf(stderr, "no such package \"%s\"\n", name);
4444        exit(1);
4545    }
46    for (pkg = id->value; pkg; pkg = pkg->more)
46    for (pkg = id->jrb->val; pkg; pkg = pkg->more)
4747        printf("%.*s\n", (int) pkg->version->len, pkg->version->s);
4848}
4949
...... 
5858        fprintf(stderr, "no such package \"%s\"\n", name);
5959        exit(1);
6060    }
61    pkg = id->value;
61    pkg = id->jrb->val;
6262    if (!pkg) {
6363        fprintf(stderr, "package %s is a ghost\n", name);
6464        exit(1);

Archive Download the corresponding diff file

Branches:
master



interactive