Updating documentation on MemPool_CleanUp function

This commit is contained in:
Kevin Yonan 2019-06-25 09:21:49 -07:00 committed by GitHub
parent 76e781b5fb
commit 5f5e143a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,7 @@ Explanation & Usage:
To deallocate memory back to the pool, there's also two functions: To deallocate memory back to the pool, there's also two functions:
```c ```c
void MemPool_Free(struct MemPool *mempool, void *ptr); void MemPool_Free(struct MemPool *mempool, void *ptr);
void MemPool_CleanUp(struct MemPool *mempool, void *ptrref); void MemPool_CleanUp(struct MemPool *mempool, void **ptrref);
``` ```
`MemPool_Free` will deallocate the pointer data back to the memory pool. `MemPool_Free` will deallocate the pointer data back to the memory pool.
@ -106,9 +106,8 @@ Explanation & Usage:
`MemPool_CleanUp` instead takes a pointer to an allocated pointer and then calls `MemPool_Free` for that pointer and then sets it to NULL. `MemPool_CleanUp` instead takes a pointer to an allocated pointer and then calls `MemPool_Free` for that pointer and then sets it to NULL.
```c ```c
// deallocates i and sets the pointer to NULL. // deallocates i and sets the pointer to NULL.
MemPool_CleanUp(&pool, &i); MemPool_CleanUp(&pool, (void **)&i);
// i is now NULL. // i is now NULL.
``` ```
Using `MemPool_CleanUp` is basically a shorthand way of doing this code: Using `MemPool_CleanUp` is basically a shorthand way of doing this code: