summaryrefslogtreecommitdiff
path: root/src/common/memarea.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-16 17:05:37 -0400
committerNick Mathewson <nickm@torproject.org>2011-03-16 17:05:37 -0400
commit6617822b841e32d6339bac13c79dd5f2b566c3c6 (patch)
tree43bbf3c16b473a89c94dfe4c44460c39cbf8eedf /src/common/memarea.c
parent7f6af7a60281f00fde2e3b3f552edcc5f9311a04 (diff)
downloadtor-6617822b841e32d6339bac13c79dd5f2b566c3c6.tar.gz
tor-6617822b841e32d6339bac13c79dd5f2b566c3c6.zip
Doxygen documentation for about 100 things that didn't have any
About 860 doxygen-less things remain in 0.2.2
Diffstat (limited to 'src/common/memarea.c')
-rw-r--r--src/common/memarea.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/memarea.c b/src/common/memarea.c
index 194deb8d2c..6893639a6e 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -30,12 +30,18 @@
#endif
#ifdef USE_SENTINELS
+/** Magic value that we stick at the end of a memarea so we can make sure
+ * there are no run-off-the-end bugs. */
#define SENTINEL_VAL 0x90806622u
+/** How many bytes per area do we devote to the sentinel? */
#define SENTINEL_LEN sizeof(uint32_t)
+/** Given a mem_area_chunk_t with SENTINEL_LEN extra bytes allocated at the
+ * end, set those bytes. */
#define SET_SENTINEL(chunk) \
STMT_BEGIN \
set_uint32( &(chunk)->u.mem[chunk->mem_size], SENTINEL_VAL ); \
STMT_END
+/** Assert that the sentinel on a memarea is set correctly. */
#define CHECK_SENTINEL(chunk) \
STMT_BEGIN \
uint32_t sent_val = get_uint32(&(chunk)->u.mem[chunk->mem_size]); \
@@ -73,8 +79,11 @@ typedef struct memarea_chunk_t {
} u;
} memarea_chunk_t;
+/** How many bytes are needed for overhead before we get to the memory part
+ * of a chunk? */
#define CHUNK_HEADER_SIZE STRUCT_OFFSET(memarea_chunk_t, u)
+/** What's the smallest that we'll allocate a chunk? */
#define CHUNK_SIZE 4096
/** A memarea_t is an allocation region for a set of small memory requests