Move to kernel style SPDX license identifiers
[babeltrace.git] / src / lib / prio-heap / prio-heap.h
index 8ea51bc148adbfb355cd99cd6dd9e4f558508a05..88d18712fd601b84763fbe95302112e545c1ddc6 100644 (file)
@@ -1,33 +1,17 @@
-#ifndef _BABELTRACE_PRIO_HEAP_H
-#define _BABELTRACE_PRIO_HEAP_H
-
 /*
- * Static-sized priority heap containing pointers. Based on CLRS,
- * chapter 6.
- *
- * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * SPDX-License-Identifier: MIT
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Static-sized priority heap containing pointers. Based on CLRS,
+ * chapter 6.
  */
 
+#ifndef _BABELTRACE_PRIO_HEAP_H
+#define _BABELTRACE_PRIO_HEAP_H
+
 #include <unistd.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 struct ptr_heap {
        size_t len, alloc_len;
@@ -54,7 +38,7 @@ void check_heap(const struct ptr_heap *heap)
 static inline void *bt_heap_maximum(const struct ptr_heap *heap)
 {
        check_heap(heap);
-       return likely(heap->len) ? heap->ptrs[0] : NULL;
+       return G_LIKELY(heap->len) ? heap->ptrs[0] : NULL;
 }
 
 /**
@@ -65,6 +49,7 @@ static inline void *bt_heap_maximum(const struct ptr_heap *heap)
  *
  * Returns -ENOMEM if out of memory.
  */
+BT_HIDDEN
 extern int bt_heap_init(struct ptr_heap *heap,
                     size_t alloc_len,
                     int gt(void *a, void *b));
@@ -73,6 +58,7 @@ extern int bt_heap_init(struct ptr_heap *heap,
  * bt_heap_free - free the heap
  * @heap: the heap to free
  */
+BT_HIDDEN
 extern void bt_heap_free(struct ptr_heap *heap);
 
 /**
@@ -84,6 +70,7 @@ extern void bt_heap_free(struct ptr_heap *heap);
  *
  * Returns -ENOMEM if out of memory.
  */
+BT_HIDDEN
 extern int bt_heap_insert(struct ptr_heap *heap, void *p);
 
 /**
@@ -93,6 +80,7 @@ extern int bt_heap_insert(struct ptr_heap *heap, void *p);
  * Returns the largest element in the heap. It removes this element from the
  * heap. Returns NULL if the heap is empty.
  */
+BT_HIDDEN
 extern void *bt_heap_remove(struct ptr_heap *heap);
 
 /**
@@ -104,6 +92,7 @@ extern void *bt_heap_remove(struct ptr_heap *heap);
  * return NULL. This algorithm has a complexity of O(n), which is higher than
  * O(log(n)) provided by the rest of this API.
  */
+BT_HIDDEN
 extern void *bt_heap_cherrypick(struct ptr_heap *heap, void *p);
 
 /**
@@ -118,6 +107,7 @@ extern void *bt_heap_cherrypick(struct ptr_heap *heap, void *p);
  * This is the equivalent of calling bt_heap_remove() and then bt_heap_insert(), but
  * it only rebalances the heap once. It never allocates memory.
  */
+BT_HIDDEN
 extern void *bt_heap_replace_max(struct ptr_heap *heap, void *p);
 
 /**
@@ -127,6 +117,7 @@ extern void *bt_heap_replace_max(struct ptr_heap *heap, void *p);
  *
  * Returns -ENOMEM if out of memory.
  */
+BT_HIDDEN
 extern int bt_heap_copy(struct ptr_heap *dst, struct ptr_heap *src);
 
 #endif /* _BABELTRACE_PRIO_HEAP_H */
This page took 0.02859 seconds and 4 git commands to generate.