projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: handle clock offset with frequency different from 1GHz
[babeltrace.git]
/
include
/
babeltrace
/
prio_heap.h
diff --git
a/include/babeltrace/prio_heap.h
b/include/babeltrace/prio_heap.h
index 51cdac56c26d693a9a655f2318c8b81d3e2c67b8..347a2ced5fa302482878fd75160c0aa61c17c1b4 100644
(file)
--- a/
include/babeltrace/prio_heap.h
+++ b/
include/babeltrace/prio_heap.h
@@
-21,6
+21,7
@@
*/
#include <unistd.h>
*/
#include <unistd.h>
+#include <babeltrace/babeltrace-internal.h>
struct ptr_heap {
size_t len, alloc_len;
struct ptr_heap {
size_t len, alloc_len;
@@
-28,6
+29,15
@@
struct ptr_heap {
int (*gt)(void *a, void *b);
};
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
/**
* heap_maximum - return the largest element in the heap
* @heap: the heap to be operated on
@@
-37,7
+47,8
@@
struct ptr_heap {
*/
static inline void *heap_maximum(const struct ptr_heap *heap)
{
*/
static inline void *heap_maximum(const struct ptr_heap *heap)
{
- return heap->len ? heap->ptrs[0] : NULL;
+ check_heap(heap);
+ return likely(heap->len) ? heap->ptrs[0] : NULL;
}
/**
}
/**
@@
-103,4
+114,13
@@
extern void *heap_cherrypick(struct ptr_heap *heap, void *p);
*/
extern void *heap_replace_max(struct ptr_heap *heap, void *p);
*/
extern void *heap_replace_max(struct ptr_heap *heap, void *p);
+/**
+ * heap_copy - copy a heap
+ * @dst: the destination heap (must be allocated)
+ * @src: the source heap
+ *
+ * Returns -ENOMEM if out of memory.
+ */
+extern int heap_copy(struct ptr_heap *dst, struct ptr_heap *src);
+
#endif /* _BABELTRACE_PRIO_HEAP_H */
#endif /* _BABELTRACE_PRIO_HEAP_H */
This page took
0.024042 seconds
and
4
git commands to generate.