From b5f56c1a437ad04dd5e56388a2535c465c002ac8 Mon Sep 17 00:00:00 2001 From: Kevin Yonan Date: Tue, 25 Jun 2019 09:24:22 -0700 Subject: [PATCH] changed *_CleanUp function parameter Replaced `void*` pointer to pointer param to `void**` so it's more explicit. --- src/rmem.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/rmem.c b/src/rmem.c index e410208d8..addf829a5 100644 --- a/src/rmem.c +++ b/src/rmem.c @@ -212,18 +212,13 @@ void MemPool_Free(struct MemPool *const restrict mempool, void *ptr) } } -void MemPool_CleanUp(struct MemPool *const restrict mempool, void *ptrref) +void MemPool_CleanUp(struct MemPool *const restrict mempool, void **ptrref) { - if (mempool==NULL || ptrref==NULL) + if (mempool==NULL || ptrref==NULL || *ptrref==NULL) return; else { - void *restrict *p = ptrref; - if (*p==NULL) { - return; - } else { - MemPool_Free(mempool, *p); - *p = NULL; - } + MemPool_Free(mempool, *ptrref); + *ptrref = NULL; } } @@ -426,18 +421,13 @@ void ObjPool_Free(struct ObjPool *const restrict objpool, void *ptr) } } -void ObjPool_CleanUp(struct ObjPool *const restrict objpool, void *ptrref) +void ObjPool_CleanUp(struct ObjPool *const restrict objpool, void **ptrref) { - if (objpool==NULL || ptrref==NULL) + if (objpool==NULL || ptrref==NULL || *ptrref==NULL) return; else { - void *restrict *p = ptrref; - if (*p==NULL) { - return; - } else { - ObjPool_Free(objpool, *p); - *p = NULL; - } + ObjPool_Free(objpool, *ptrref); + *ptrref = NULL; } } /***************************************************/