commit doc: document that -c, -C, -F and --fixup with -m error
[git.git] / t / helper / test-prio-queue.c
blobae58fff35972a09c08a47d2bc0abb67c96ba20eb
1 #include "cache.h"
2 #include "prio-queue.h"
4 static int intcmp(const void *va, const void *vb, void *data)
6 const int *a = va, *b = vb;
7 return *a - *b;
10 static void show(int *v)
12 if (!v)
13 printf("NULL\n");
14 else
15 printf("%d\n", *v);
16 free(v);
19 int cmd_main(int argc, const char **argv)
21 struct prio_queue pq = { intcmp };
23 while (*++argv) {
24 if (!strcmp(*argv, "get"))
25 show(prio_queue_get(&pq));
26 else if (!strcmp(*argv, "dump")) {
27 int *v;
28 while ((v = prio_queue_get(&pq)))
29 show(v);
31 else {
32 int *v = malloc(sizeof(*v));
33 *v = atoi(*argv);
34 prio_queue_put(&pq, v);
38 return 0;