]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
30bdd695 LP |
2 | #pragma once |
3 | ||
11c3a366 TA |
4 | #include <stdbool.h> |
5 | ||
30bdd695 | 6 | #include "hashmap.h" |
11c3a366 | 7 | #include "macro.h" |
30bdd695 LP |
8 | |
9 | typedef struct Prioq Prioq; | |
10 | ||
fd38203a LP |
11 | #define PRIOQ_IDX_NULL ((unsigned) -1) |
12 | ||
30bdd695 | 13 | Prioq *prioq_new(compare_func_t compare); |
cab5b059 | 14 | Prioq *prioq_free(Prioq *q); |
d13b5f5a | 15 | DEFINE_TRIVIAL_CLEANUP_FUNC(Prioq*, prioq_free); |
e3017af9 | 16 | int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func); |
30bdd695 LP |
17 | |
18 | int prioq_put(Prioq *q, void *data, unsigned *idx); | |
19 | int prioq_remove(Prioq *q, void *data, unsigned *idx); | |
20 | int prioq_reshuffle(Prioq *q, void *data, unsigned *idx); | |
21 | ||
44a6b1b6 | 22 | void *prioq_peek(Prioq *q) _pure_; |
30bdd695 LP |
23 | void *prioq_pop(Prioq *q); |
24 | ||
44a6b1b6 ZJS |
25 | unsigned prioq_size(Prioq *q) _pure_; |
26 | bool prioq_isempty(Prioq *q) _pure_; |