Fix: lib: pass down API function name to some helpers
[babeltrace.git] / src / lib / object-pool.h
index e94e04d24801a7b1b64c6e9ef8969a92dc4624db..5f65c59dcdc945d4f3e11446ef62c10886efd410 100644 (file)
@@ -1,28 +1,12 @@
-#ifndef BABELTRACE_OBJECT_POOL_INTERNAL_H
-#define BABELTRACE_OBJECT_POOL_INTERNAL_H
-
 /*
- * Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
- *
- * 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:
+ * SPDX-License-Identifier: MIT
  *
- * 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.
+ * Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
  */
 
+#ifndef BABELTRACE_OBJECT_POOL_INTERNAL_H
+#define BABELTRACE_OBJECT_POOL_INTERNAL_H
+
 /*
  * This is a generic object pool to avoid memory allocation/deallocation
  * for objects of which the lifespan is typically short, but which are
@@ -57,7 +41,7 @@
 #endif
 
 typedef void *(*bt_object_pool_new_object_func)(void *data);
-typedef void *(*bt_object_pool_destroy_object_func)(void *obj, void *data);
+typedef void (*bt_object_pool_destroy_object_func)(void *obj, void *data);
 
 struct bt_object_pool {
        /*
@@ -88,6 +72,7 @@ struct bt_object_pool {
 /*
  * Initializes an object pool which is already allocated.
  */
+BT_HIDDEN
 int bt_object_pool_initialize(struct bt_object_pool *pool,
                bt_object_pool_new_object_func new_object_func,
                bt_object_pool_destroy_object_func destroy_object_func,
@@ -96,6 +81,7 @@ int bt_object_pool_initialize(struct bt_object_pool *pool,
 /*
  * Finalizes an object pool without deallocating it.
  */
+BT_HIDDEN
 void bt_object_pool_finalize(struct bt_object_pool *pool);
 
 /*
@@ -111,7 +97,7 @@ void *bt_object_pool_create_object(struct bt_object_pool *pool)
 {
        struct bt_object *obj;
 
-       BT_ASSERT(pool);
+       BT_ASSERT_DBG(pool);
        BT_LOGT("Creating object from pool: pool-addr=%p, pool-size=%zu, pool-cap=%u",
                pool, pool->size, pool->objects->len);
 
@@ -144,8 +130,8 @@ void bt_object_pool_recycle_object(struct bt_object_pool *pool, void *obj)
 {
        struct bt_object *bt_obj = obj;
 
-       BT_ASSERT(pool);
-       BT_ASSERT(obj);
+       BT_ASSERT_DBG(pool);
+       BT_ASSERT_DBG(obj);
        BT_LOGT("Recycling object: pool-addr=%p, pool-size=%zu, pool-cap=%u, obj-addr=%p",
                pool, pool->size, pool->objects->len, obj);
 
This page took 0.024984 seconds and 4 git commands to generate.