diff options
author | Damien George <damien.p.george@gmail.com> | 2020-03-16 15:36:43 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-03-26 01:21:04 +1100 |
commit | 6c7e78de7223c60f4b762e8b4d33f754d65921d8 (patch) | |
tree | 5a0c7fc5cc87b315b6896c2e94c87c1637a47e65 /py | |
parent | c47a3ddf4ac1bdaf74080454e3993b0cb2a97d66 (diff) |
py/pairheap: Add helper function to initialise a new node.
Diffstat (limited to 'py')
-rw-r--r-- | py/pairheap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/pairheap.h b/py/pairheap.h index 16ae78809..68b8b0f75 100644 --- a/py/pairheap.h +++ b/py/pairheap.h @@ -64,6 +64,13 @@ static inline mp_pairheap_t *mp_pairheap_new(mp_pairheap_lt_t lt) { return NULL; } +// Initialise a single pairing-heap node so it is ready to push on to a heap. +static inline void mp_pairheap_init_node(mp_pairheap_lt_t lt, mp_pairheap_t *node) { + (void)lt; + node->child = NULL; + node->next = NULL; +} + // Test if the heap is empty. static inline bool mp_pairheap_is_empty(mp_pairheap_lt_t lt, mp_pairheap_t *heap) { (void)lt; |