From 6c7e78de7223c60f4b762e8b4d33f754d65921d8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 16 Mar 2020 15:36:43 +1100 Subject: [PATCH] py/pairheap: Add helper function to initialise a new node. --- py/pairheap.h | 7 +++++++ 1 file changed, 7 insertions(+) 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;