Skip to content

Commit 4581df9

Browse files
committed
Rename 'pool_close' to 'pool_destroy'
1 parent a6fbd7e commit 4581df9

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

README.org

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ described below:
4949
3. When a chunk is no longer needed, free it so it can be used by subsequent
5050
allocations.
5151
4. Optionally expand the pool, if you run out of chunks.
52-
5. When the pool itself is no longer needed, close it.
52+
5. When the pool itself is no longer needed, destroy it.
5353

5454
For a full example, see [[file:src/libpool-test.c][src/libpool-test.c]].
5555

@@ -65,7 +65,7 @@ This library consists of only 5 functions:
6565

6666
This function will allocate a =Pool= structure, along with the array of chunks
6767
used for later allocations. The caller must free the returned pointer using
68-
=pool_close=.
68+
=pool_destroy=.
6969

7070
Note that the =chunk_sz= argument must be greater or equal than
7171
=sizeof(void*)=. For more information, see the /Caveats/ section.
@@ -77,11 +77,11 @@ This library consists of only 5 functions:
7777
On success, it returns /true/; otherwise, it returns /false/ and leaves the pool
7878
unchanged.
7979

80-
- Function: =pool_close= ::
80+
- Function: =pool_destroy= ::
8181

8282
Free all data in a =Pool= structure, along with the structure itself. After a
83-
pool is closed, all data previously allocated from that pool (with =pool_alloc=)
84-
becomes unusable.
83+
pool is destroyed, all data previously allocated from that pool (with
84+
=pool_alloc=) becomes unusable.
8585

8686
Allows =NULL= as the argument.
8787

src/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static void benchmark_libpool(size_t nmemb, size_t size) {
2525

2626
while (ptrs_pos > 0)
2727
pool_free(pool, ptrs[--ptrs_pos]);
28-
pool_close(pool);
28+
pool_destroy(pool);
2929
}
3030

3131
static void benchmark_malloc(size_t nmemb, size_t size) {

src/libpool-test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static void test_pool(Pool* pool) {
5151
/*
5252
* Keep allocating until we run out of chunks, to illustrate what happens
5353
* after too many allocations. We are "leaking" pool memory in this loop,
54-
* but it's not really leaked to the system because we will `close' the pool
54+
* but it's not really leaked to the system because we will destroy the pool
5555
* later.
5656
*/
5757
for (i = 0; i < 35; i++) {
@@ -108,12 +108,12 @@ int main(void) {
108108
test_pool(pool1);
109109

110110
/*
111-
* When we are done, we "close" each pool. All previously allocated data
111+
* When we are done, we destroy each pool. All previously allocated data
112112
* from the pool becomes unusable, and the necessary resources allocated by
113113
* `pool_new' are freed.
114114
*/
115-
pool_close(pool2);
116-
pool_close(pool1);
115+
pool_destroy(pool2);
116+
pool_destroy(pool1);
117117

118118
return 0;
119119
}

src/libpool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ bool pool_expand(Pool* pool, size_t extra_sz) {
215215
* contain the base address of each chunk array. We free the array, and then the
216216
* `ArrayStart' structure itself. Lastly, we free the `Pool' structure.
217217
*/
218-
void pool_close(Pool* pool) {
218+
void pool_destroy(Pool* pool) {
219219
ArrayStart* array_start;
220220
ArrayStart* next;
221221

src/libpool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef struct Pool Pool;
2626

2727
/*
2828
* External functions for allocating and freeing system memory. Used by
29-
* `pool_new' and `pool_close'.
29+
* `pool_new' and `pool_detroy'.
3030
*
3131
* If `LIBPOOL_NO_STDLIB' is defined, they are set to NULL, so the user must
3232
* initialize them. Otherwise, their default value is `malloc' and `free', from
@@ -43,7 +43,7 @@ extern PoolFreeFuncPtr pool_ext_free;
4343
*
4444
* Notes:
4545
* - If the initialization fails, NULL is returned.
46-
* - The caller must free the returned pointer using `pool_close'.
46+
* - The caller must free the returned pointer using `pool_destroy'.
4747
* - The `chunk_sz' must be greater or equal than `sizeof(void*)'.
4848
* - The pool size can be updated with `pool_expand', but the chunk size
4949
* cannot be changed.
@@ -63,7 +63,7 @@ bool pool_expand(Pool* pool, size_t extra_sz);
6363
* data allocated from this the pool becomes unusable. Allows NULL as the
6464
* `pool' parameter.
6565
*/
66-
void pool_close(Pool* pool);
66+
void pool_destroy(Pool* pool);
6767

6868
/*
6969
* Allocate a fixed-size chunk from the specified pool. If no chunks are

0 commit comments

Comments
 (0)