From 0d0c9ea07b0c8875f6c1e9161e56e74b9adbd8c0 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Sat, 3 Jun 2023 10:04:33 -0400 Subject: [PATCH] pool: Use bool return type Issue: 5563 This commit changes PoolDataPreAllocated to return a bool instead of an int. --- src/util-pool.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util-pool.c b/src/util-pool.c index b8fe4abb4f..26d6480099 100644 --- a/src/util-pool.c +++ b/src/util-pool.c @@ -54,14 +54,14 @@ static int PoolMemset(void *pitem, void *initdata) /** * \brief Check if data is preallocated - * \retval 0 if not inside the prealloc'd block, 1 if inside */ -static int PoolDataPreAllocated(Pool *p, void *data) + * \retval false if not inside the prealloc'd block, true if inside */ +static bool PoolDataPreAllocated(Pool *p, void *data) { ptrdiff_t delta = data - p->data_buffer; if ((delta < 0) || (delta > p->data_buffer_size)) { - return 0; + return false; } - return 1; + return true; } /** \brief Init a Pool @@ -233,7 +233,7 @@ void PoolFree(Pool *p) p->alloc_stack = pb->next; if (p->Cleanup) p->Cleanup(pb->data); - if (PoolDataPreAllocated(p, pb->data) == 0) { + if (!PoolDataPreAllocated(p, pb->data)) { if (p->Free) p->Free(pb->data); else @@ -251,7 +251,7 @@ void PoolFree(Pool *p) if (pb->data!= NULL) { if (p->Cleanup) p->Cleanup(pb->data); - if (PoolDataPreAllocated(p, pb->data) == 0) { + if (!PoolDataPreAllocated(p, pb->data)) { if (p->Free) p->Free(pb->data); else @@ -350,7 +350,7 @@ void PoolReturn(Pool *p, void *data) if (p->Cleanup != NULL) { p->Cleanup(data); } - if (PoolDataPreAllocated(p, data) == 0) { + if (!PoolDataPreAllocated(p, data)) { if (p->Free) p->Free(data); else -- 2.47.2