From: Jeff Lucovsky Date: Sat, 3 Jun 2023 14:04:33 +0000 (-0400) Subject: pool: Use bool return type X-Git-Tag: suricata-7.0.0-rc2~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d0c9ea07b0c8875f6c1e9161e56e74b9adbd8c0;p=thirdparty%2Fsuricata.git pool: Use bool return type Issue: 5563 This commit changes PoolDataPreAllocated to return a bool instead of an int. --- 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