X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fprio_heap.h;h=347a2ced5fa302482878fd75160c0aa61c17c1b4;hp=1a523313f84134d07f75f3c547a294dd6128c0a7;hb=75d9ab4b8164f7b2012da916c5b36f1445e9ee09;hpb=eacd552cb253ddc9d05fac6b753fcab84124d9cf diff --git a/include/babeltrace/prio_heap.h b/include/babeltrace/prio_heap.h index 1a523313..347a2ced 100644 --- a/include/babeltrace/prio_heap.h +++ b/include/babeltrace/prio_heap.h @@ -21,6 +21,7 @@ */ #include +#include struct ptr_heap { size_t len, alloc_len; @@ -47,7 +48,7 @@ void check_heap(const struct ptr_heap *heap) static inline void *heap_maximum(const struct ptr_heap *heap) { check_heap(heap); - return heap->len ? heap->ptrs[0] : NULL; + return likely(heap->len) ? heap->ptrs[0] : NULL; } /** @@ -113,4 +114,13 @@ extern void *heap_cherrypick(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 */