changed *_CleanUp function parameter
Replaced `void*` pointer to pointer param to `void**` so it's more explicit.
This commit is contained in:
parent
eda842ccf2
commit
b5f56c1a43
26
src/rmem.c
26
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;
|
return;
|
||||||
else {
|
else {
|
||||||
void *restrict *p = ptrref;
|
MemPool_Free(mempool, *ptrref);
|
||||||
if (*p==NULL) {
|
*ptrref = NULL;
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
MemPool_Free(mempool, *p);
|
|
||||||
*p = 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;
|
return;
|
||||||
else {
|
else {
|
||||||
void *restrict *p = ptrref;
|
ObjPool_Free(objpool, *ptrref);
|
||||||
if (*p==NULL) {
|
*ptrref = NULL;
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
ObjPool_Free(objpool, *p);
|
|
||||||
*p = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user