diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-02-16 20:01:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-02-16 20:01:02 +0000 |
commit | 11e5656ab7fdbf8bad2e041261542f2bda6a5a8c (patch) | |
tree | 0ab37c179ee7e8466c2d4504edf2491d3411ffb2 /src/or/buffers.c | |
parent | ae7576a19e5294b3c586363397a45585e2a523bc (diff) | |
download | tor-11e5656ab7fdbf8bad2e041261542f2bda6a5a8c.tar.gz tor-11e5656ab7fdbf8bad2e041261542f2bda6a5a8c.zip |
r11826@catbus: nickm | 2007-02-16 14:58:38 -0500
Resolve 56 DOCDOC comments.
svn:r9594
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 008e92788d..d8f39b85d5 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -20,15 +20,25 @@ const char buffers_c_id[] = #undef PARANOIA #undef NOINLINE -#ifdef SENTINELS /* If SENTINELS is defined, check for attempts to write beyond the - * end/before the start of the buffer. DOCDOC macros + * end/before the start of the buffer. */ +#ifdef SENTINELS +/* 4-byte value to write at the start of each buffer memory region */ #define START_MAGIC 0x70370370u +/* 4-byte value to write at the end of each buffer memory region */ #define END_MAGIC 0xA0B0C0D0u +/* Given buf->mem, yield a pointer to the raw memory region (for free(), + * realloc(), and so on) */ #define RAW_MEM(m) ((void*)(((char*)m)-4)) +/* Given a pointer to the raw memory region (from malloc() or realloc()), + * yield the correct value for buf->mem (just past the first sentinel). */ #define GUARDED_MEM(m) ((void*)(((char*)m)+4)) +/* How much memory do we need to allocate for a buffer to hold <b>ln</b> bytes + * of data? */ #define ALLOC_LEN(ln) ((ln)+8) +/* Initialize the sentinel values on <b>m</b> (a value of buf->mem), which + * has <b>ln</b> useful bytes. */ #define SET_GUARDS(m, ln) \ do { set_uint32((m)-4,START_MAGIC); set_uint32((m)+ln,END_MAGIC); } while (0) #else @@ -49,7 +59,7 @@ const char buffers_c_id[] = #define INLINE #endif -/* DOCDOC */ +/** Magic value for buf_t.magic, to catch pointer errors. */ #define BUFFER_MAGIC 0xB0FFF312u /** A resizeable buffer, optimized for reading and writing. */ struct buf_t { |