| static int intcmp(const void *va, const void *vb, void *data) |
| const int *a = va, *b = vb; |
| int cmd__prio_queue(int argc, const char **argv) |
| struct prio_queue pq = { intcmp }; |
| if (!strcmp(*argv, "get")) { |
| void *peek = prio_queue_peek(&pq); |
| void *get = prio_queue_get(&pq); |
| BUG("peek and get results do not match"); |
| } else if (!strcmp(*argv, "dump")) { |
| while ((peek = prio_queue_peek(&pq))) { |
| get = prio_queue_get(&pq); |
| BUG("peek and get results do not match"); |
| } else if (!strcmp(*argv, "stack")) { |
| int *v = xmalloc(sizeof(*v)); |