prioq: coding style fixes

This commit is contained in:
Yu Watanabe
2025-05-05 22:53:01 +02:00
committed by Mike Yuan
parent ab46feb3e2
commit a3a98a3793
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ struct Prioq {
struct prioq_item *items;
};
Prioq *prioq_new(compare_func_t compare_func) {
Prioq* prioq_new(compare_func_t compare_func) {
Prioq *q;
q = new(Prioq, 1);
@@ -269,7 +269,7 @@ void prioq_reshuffle(Prioq *q, void *data, unsigned *idx) {
shuffle_up(q, k);
}
void *prioq_peek_by_index(Prioq *q, unsigned idx) {
void* prioq_peek_by_index(Prioq *q, unsigned idx) {
if (!q)
return NULL;
@@ -279,7 +279,7 @@ void *prioq_peek_by_index(Prioq *q, unsigned idx) {
return q->items[idx].data;
}
void *prioq_pop(Prioq *q) {
void* prioq_pop(Prioq *q) {
void *data;
if (!q)
+4 -4
View File
@@ -10,8 +10,8 @@ typedef struct Prioq Prioq;
#define PRIOQ_IDX_NULL (UINT_MAX)
Prioq *prioq_new(compare_func_t compare);
Prioq *prioq_free(Prioq *q);
Prioq* prioq_new(compare_func_t compare);
Prioq* prioq_free(Prioq *q);
DEFINE_TRIVIAL_CLEANUP_FUNC(Prioq*, prioq_free);
int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func);
@@ -20,11 +20,11 @@ int prioq_ensure_put(Prioq **q, compare_func_t compare_func, void *data, unsigne
int prioq_remove(Prioq *q, void *data, unsigned *idx);
void prioq_reshuffle(Prioq *q, void *data, unsigned *idx);
void *prioq_peek_by_index(Prioq *q, unsigned idx) _pure_;
void* prioq_peek_by_index(Prioq *q, unsigned idx) _pure_;
static inline void *prioq_peek(Prioq *q) {
return prioq_peek_by_index(q, 0);
}
void *prioq_pop(Prioq *q);
void* prioq_pop(Prioq *q);
#define PRIOQ_FOREACH_ITEM(q, p) \
for (unsigned _i = 0; (p = prioq_peek_by_index(q, _i)); _i++)