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