X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fprio_heap.h;h=1a523313f84134d07f75f3c547a294dd6128c0a7;hp=51cdac56c26d693a9a655f2318c8b81d3e2c67b8;hb=eacd552cb253ddc9d05fac6b753fcab84124d9cf;hpb=75cc2c3593a5cec870fb530ed4712b5c13d9f0db diff --git a/include/babeltrace/prio_heap.h b/include/babeltrace/prio_heap.h index 51cdac56..1a523313 100644 --- a/include/babeltrace/prio_heap.h +++ b/include/babeltrace/prio_heap.h @@ -28,6 +28,15 @@ struct ptr_heap { int (*gt)(void *a, void *b); }; +#ifdef DEBUG_HEAP +void check_heap(const struct ptr_heap *heap); +#else +static inline +void check_heap(const struct ptr_heap *heap) +{ +} +#endif + /** * heap_maximum - return the largest element in the heap * @heap: the heap to be operated on @@ -37,6 +46,7 @@ struct ptr_heap { */ static inline void *heap_maximum(const struct ptr_heap *heap) { + check_heap(heap); return heap->len ? heap->ptrs[0] : NULL; }