X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fobject-pool.h;h=5f65c59dcdc945d4f3e11446ef62c10886efd410;hb=827e42e017fc5f525aa39a3851bf2e7e50e887aa;hp=02118999f6b8e8a54ccf99b63c5475012ca25b03;hpb=9c7f2f8572e28b311e918168f70e6feebf33c52b;p=babeltrace.git diff --git a/src/lib/object-pool.h b/src/lib/object-pool.h index 02118999..5f65c59d 100644 --- a/src/lib/object-pool.h +++ b/src/lib/object-pool.h @@ -1,28 +1,12 @@ -#ifndef BABELTRACE_OBJECT_POOL_INTERNAL_H -#define BABELTRACE_OBJECT_POOL_INTERNAL_H - /* - * Copyright (c) 2018 Philippe Proulx - * - * 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 */ +#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 @@ -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);