summaryrefslogtreecommitdiff
path: root/src/common/memarea.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-05 20:34:22 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-05 20:34:22 +0000
commit3ebd1ebeca2edc09027dd583149c64c48c3e7832 (patch)
treed6ef3b849c954446b35296836dff8da55bd16765 /src/common/memarea.c
parent35bef7fefd6e8fabf759da7c54d8003210661896 (diff)
downloadtor-3ebd1ebeca2edc09027dd583149c64c48c3e7832.tar.gz
tor-3ebd1ebeca2edc09027dd583149c64c48c3e7832.zip
The chunk_size field in memarea_t was never actually set. Remove the whole thing.
svn:r17195
Diffstat (limited to 'src/common/memarea.c')
-rw-r--r--src/common/memarea.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common/memarea.c b/src/common/memarea.c
index 28144c3bb9..d888cf076a 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -53,13 +53,12 @@ typedef struct memarea_chunk_t {
#define CHUNK_HEADER_SIZE STRUCT_OFFSET(memarea_chunk_t, u)
-#define CHUNK_SIZE 8192
+#define CHUNK_SIZE 4096
/** A memarea_t is an allocation region for a set of small memory requests
* that will all be freed at once. */
struct memarea_t {
- struct memarea_chunk_t *first; /**< Top of the chunk stack: never NULL. */
- size_t chunk_size; /**<Size to use when allocating chunks.*/
+ memarea_chunk_t *first; /**< Top of the chunk stack: never NULL. */
};
#define MAX_FREELIST_LEN 4
@@ -101,11 +100,10 @@ chunk_free(memarea_chunk_t *chunk)
/** Allocate and return new memarea. */
memarea_t *
-memarea_new(size_t chunk_size)/*XXXX021 remove this argument.*/
+memarea_new(void)
{
memarea_t *head = tor_malloc(sizeof(memarea_t));
- head->first = alloc_chunk(chunk_size, 1);
- (void)chunk_size;
+ head->first = alloc_chunk(CHUNK_SIZE, 1);
return head;
}
@@ -185,7 +183,7 @@ memarea_alloc(memarea_t *area, size_t sz)
chunk->next_chunk = new_chunk;
chunk = new_chunk;
} else {
- memarea_chunk_t *new_chunk = alloc_chunk(area->chunk_size, 1);
+ memarea_chunk_t *new_chunk = alloc_chunk(CHUNK_SIZE, 1);
new_chunk->next_chunk = chunk;
area->first = chunk = new_chunk;
}