Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
| 1 | /* |
| 2 | * fixup.c - Adjust things after parsing is done |
| 3 | * |
| 4 | * Written 2010 by Werner Almesberger |
| 5 | * Copyright 2010 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | #include <stdio.h> |
| 15 | |
| 16 | #include "jrb.h" |
| 17 | |
| 18 | #include "pkg.h" |
| 19 | #include "qpkg.h" |
| 20 | #include "fixup.h" |
| 21 | |
| 22 | |
| 23 | void sort_versions(void) |
| 24 | { |
| 25 | const struct jrb *n; |
| 26 | struct pkg **a, **b; |
| 27 | struct pkg *tmp; |
| 28 | |
| 29 | for (n = jrb_first(packages->root); n != jrb_nil(packages->root); |
| 30 | n = jrb_next(n)) |
| 31 | for (a = (struct pkg **) &n->val; *a; a = &(*a)->more) |
| 32 | for (b = &(*a)->more; *b;) |
| 33 | if (comp_versions((*a)->version, |
| 34 | (*b)->version) >= 0) |
| 35 | b = &(*b)->more; |
| 36 | else { |
| 37 | tmp = *a; |
| 38 | *a = *b; |
| 39 | *b = tmp; |
| 40 | tmp = (*a)->more; |
| 41 | (*a)->more = (*b)->more; |
| 42 | (*b)->more = tmp; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void complete_provisions(void) |
| 48 | { |
| 49 | struct jrb *n; |
| 50 | |
| 51 | for (n = jrb_first(packages->root); n != jrb_nil(packages->root); |
| 52 | n = jrb_next(n)) |
| 53 | if (!n->val) |
| 54 | new_pkg(n)->flags |= QPKG_PROVIDED; |
| 55 | } |
| 56 |
Branches:
master
