Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Commit Details
Date: | 2010-11-21 07:25:53 (13 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | dd0ee663045491fb1a95ccb0c0fb0dd0918122bf |
Message: | qpkg: give ID2S macro a more "offical" status - prereq.c (ID2S), id.h (ID2PF): renamed ID2S to ID2PF and moved it to id.h - prereq.c (push, satisfies, resolve): change ID2S to ID2PF |
Files: |
qpkg/id.h (1 diff) qpkg/prereq.c (4 diffs) |
Change Details
qpkg/id.h | ||
---|---|---|
59 | 59 | }; |
60 | 60 | |
61 | 61 | |
62 | /* | |
63 | * Helper macro for printing identifiers. | |
64 | * Use with "... %.*s ..." | |
65 | */ | |
66 | ||
67 | #define ID2PF(id) (int) (id)->len, (id)->s | |
68 | ||
69 | ||
62 | 70 | int comp_id(const void *a, const void *b); |
63 | 71 | |
64 | 72 | struct tree *make_tree(int (*comp)(const void *a, const void *b)); |
qpkg/prereq.c | ||
---|---|---|
36 | 36 | static int stack_max = 0; |
37 | 37 | |
38 | 38 | |
39 | #define ID2S(id) (int) (id)->len, (id)->s | |
40 | ||
41 | ||
42 | 39 | static int epoch(const char **s, const struct id *id) |
43 | 40 | { |
44 | 41 | const char *end = id->s+id->len; |
... | ... | |
114 | 111 | |
115 | 112 | static void push(struct pkg *pkg) |
116 | 113 | { |
117 | //fprintf(stderr, "push %.*s\n", ID2S(pkg->id)); | |
114 | //fprintf(stderr, "push %.*s\n", ID2PF(pkg->id)); | |
118 | 115 | if (n_stack == stack_max) { |
119 | 116 | stack_max = (stack_max+1)*2; |
120 | 117 | stack = realloc(stack, sizeof(*stack)*stack_max); |
... | ... | |
149 | 146 | assert(pkg->version); |
150 | 147 | cmp = comp_versions(pkg->version, ref->version); |
151 | 148 | //fprintf(stderr, "%.*s <%d> %.*s\n", |
152 | // ID2S(pkg->version), cmp, ID2S(ref->version)); | |
149 | // ID2PF(pkg->version), cmp, ID2PF(ref->version)); | |
153 | 150 | switch (ref->relop) { |
154 | 151 | case rel_eq: |
155 | 152 | return !cmp; |
... | ... | |
193 | 190 | return; |
194 | 191 | #if 0 |
195 | 192 | fprintf(stderr, "%*s", level, ""); |
196 | fprintf(stderr, "%.*s %p", ID2S(pkg->id), pkg); | |
193 | fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg); | |
197 | 194 | if (pkg->version) |
198 | fprintf(stderr, " %.*s", ID2S(pkg->version)); | |
195 | fprintf(stderr, " %.*s", ID2PF(pkg->version)); | |
199 | 196 | if (pkg->mark) fprintf(stderr, " +"); |
200 | 197 | if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***"); |
201 | 198 | fprintf(stderr, "\n"); |
Branches:
master