diff options
| -rw-r--r-- | priority_queue.c | 2 | ||||
| -rw-r--r-- | priority_queue.h | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/priority_queue.c b/priority_queue.c index c8afec6..e4dca9a 100644 --- a/priority_queue.c +++ b/priority_queue.c @@ -7,7 +7,6 @@ PositionPQ *ppq_new(Position pos, size_t priority) { PositionPQ *ppq = malloc(sizeof(PositionPQ)); ppq->pos = pos; ppq->priority = priority; - ppq->prev = NULL; ppq->next = NULL; return ppq; } @@ -55,7 +54,6 @@ Position ppq_pop(PositionPQ **ppq) { } Position pos = (*ppq)->pos; if ((*ppq)->next != NULL) { /* If there's a next node */ - (*ppq)->next->prev = NULL; PositionPQ *next = (*ppq)->next; free((*ppq)); (*ppq) = next; diff --git a/priority_queue.h b/priority_queue.h index 13eea1a..c121487 100644 --- a/priority_queue.h +++ b/priority_queue.h @@ -3,13 +3,11 @@ #include "structs.h" -/* This is basically a sorted linked list - * Not sure if we need *prev, to be fair - * UPDATE: we do need *prev. */ +/* This is basically a sorted linked list + * Pro tip: if you always use the same priority, this becomes a regular queue */ struct PositionPQNode_s { Position pos; size_t priority; /* Lower is "better" */ - struct PositionPQNode_s *prev; struct PositionPQNode_s *next; }; |
