static inline CC_HINT(always_inline) void fr_heap_bubble(fr_heap_t *h, fr_heap_index_t child)
{
- if (!fr_cond_assert(child > 0)) return;
+ if (!fr_cond_assert(child != FR_HEAP_INDEX_INVALID)) return;
/*
* Bubble up the element.
typedef unsigned int fr_heap_index_t;
typedef unsigned int fr_heap_iter_t;
+#define FR_HEAP_INDEX_INVALID (0)
+
/** How many talloc headers need to be pre-allocated for a heap
*/
#define FR_HEAP_TALLOC_HEADERS 2
*/
static inline bool fr_heap_entry_inserted(fr_heap_index_t heap_idx)
{
- return (heap_idx > 0);
+ return (heap_idx != FR_HEAP_INDEX_INVALID);
}
/** Return the item from the top of the heap but don't pop it