1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 04:24:03 +02:00

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
This commit is contained in:
Werner Almesberger 2010-11-21 03:25:53 -03:00
parent 44e4434b4c
commit dd0ee66304
2 changed files with 12 additions and 7 deletions

View File

@ -59,6 +59,14 @@ struct id {
};
/*
* Helper macro for printing identifiers.
* Use with "... %.*s ..."
*/
#define ID2PF(id) (int) (id)->len, (id)->s
int comp_id(const void *a, const void *b);
struct tree *make_tree(int (*comp)(const void *a, const void *b));

View File

@ -36,9 +36,6 @@ static int n_stack = 0;
static int stack_max = 0;
#define ID2S(id) (int) (id)->len, (id)->s
static int epoch(const char **s, const struct id *id)
{
const char *end = id->s+id->len;
@ -114,7 +111,7 @@ static void done(void)
static void push(struct pkg *pkg)
{
//fprintf(stderr, "push %.*s\n", ID2S(pkg->id));
//fprintf(stderr, "push %.*s\n", ID2PF(pkg->id));
if (n_stack == stack_max) {
stack_max = (stack_max+1)*2;
stack = realloc(stack, sizeof(*stack)*stack_max);
@ -149,7 +146,7 @@ static int satisfies(const struct pkg *pkg, const struct ref *ref)
assert(pkg->version);
cmp = comp_versions(pkg->version, ref->version);
//fprintf(stderr, "%.*s <%d> %.*s\n",
// ID2S(pkg->version), cmp, ID2S(ref->version));
// ID2PF(pkg->version), cmp, ID2PF(ref->version));
switch (ref->relop) {
case rel_eq:
return !cmp;
@ -193,9 +190,9 @@ static int level = 0;
return;
#if 0
fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2S(pkg->id), pkg);
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2S(pkg->version));
fprintf(stderr, " %.*s", ID2PF(pkg->version));
if (pkg->mark) fprintf(stderr, " +");
if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***");
fprintf(stderr, "\n");