Add heap debug option, fix heap
[babeltrace.git] / include / babeltrace / prio_heap.h
index 51cdac56c26d693a9a655f2318c8b81d3e2c67b8..1a523313f84134d07f75f3c547a294dd6128c0a7 100644 (file)
@@ -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;
 }
 
This page took 0.022837 seconds and 4 git commands to generate.