aboutsummaryrefslogtreecommitdiff
path: root/src/common/memarea.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2009-09-28 16:37:01 +0200
committerSebastian Hahn <sebastian@torproject.org>2009-12-12 03:29:44 +0100
commit3807db001d71c51e53c1897ae067671f5b771f2f (patch)
tree6c6f648f072d24e7bbf554de12519b27cd9ef888 /src/common/memarea.c
parent4afdb79051f7b1caba49877fb57be60bda9d4514 (diff)
downloadtor-3807db001d71c51e53c1897ae067671f5b771f2f.tar
tor-3807db001d71c51e53c1897ae067671f5b771f2f.tar.gz
*_free functions now accept NULL
Some *_free functions threw asserts when passed NULL. Now all of them accept NULL as input and perform no action when called that way. This gains us consistence for our free functions, and allows some code simplifications where an explicit null check is no longer necessary.
Diffstat (limited to 'src/common/memarea.c')
-rw-r--r--src/common/memarea.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/memarea.c b/src/common/memarea.c
index e7f672064..661bd85da 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -121,7 +121,7 @@ alloc_chunk(size_t sz, int freelist_ok)
/** Release <b>chunk</b> from a memarea, either by adding it to the freelist
* or by freeing it if the freelist is already too big. */
static void
-chunk_free(memarea_chunk_t *chunk)
+chunk_free_unchecked(memarea_chunk_t *chunk)
{
CHECK_SENTINEL(chunk);
if (freelist_len < MAX_FREELIST_LEN) {
@@ -151,7 +151,7 @@ memarea_drop_all(memarea_t *area)
memarea_chunk_t *chunk, *next;
for (chunk = area->first; chunk; chunk = next) {
next = chunk->next_chunk;
- chunk_free(chunk);
+ chunk_free_unchecked(chunk);
}
area->first = NULL; /*fail fast on */
tor_free(area);
@@ -167,7 +167,7 @@ memarea_clear(memarea_t *area)
if (area->first->next_chunk) {
for (chunk = area->first->next_chunk; chunk; chunk = next) {
next = chunk->next_chunk;
- chunk_free(chunk);
+ chunk_free_unchecked(chunk);
}
area->first->next_chunk = NULL;
}