summaryrefslogtreecommitdiff
path: root/src/common/memarea.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-22 19:14:08 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-22 19:14:08 +0000
commitb4d387c28bbcfabfc8baa1b63db396888534519a (patch)
treecfcf2aa91d3c404749eda39b6a10078f6ff39238 /src/common/memarea.c
parent7d79bec54d7b37aacb3914f4baa792315ce4f905 (diff)
downloadtor-b4d387c28bbcfabfc8baa1b63db396888534519a.tar.gz
tor-b4d387c28bbcfabfc8baa1b63db396888534519a.zip
Make freelist_len in memarea.c static; document a few variables.
svn:r17741
Diffstat (limited to 'src/common/memarea.c')
-rw-r--r--src/common/memarea.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/memarea.c b/src/common/memarea.c
index 592d03b46c..93b9d4f921 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -61,10 +61,12 @@ struct memarea_t {
memarea_chunk_t *first; /**< Top of the chunk stack: never NULL. */
};
+/** How many chunks will we put into the freelist before freeing them? */
#define MAX_FREELIST_LEN 4
-/* DOCDOC freelist_len */
-int freelist_len=0;
-/* DOCDOC freelist */
+/** The number of memarea chunks currently in our freelist. */
+static int freelist_len=0;
+/** A linked list of unused memory area chunks. Used to prevent us from
+ * spinning in malloc/free loops. */
static memarea_chunk_t *freelist = NULL;
/** Helper: allocate a new memarea chunk of around <b>chunk_size</b> bytes. */