summaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-07-16 20:36:54 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-07-16 20:36:54 +0000
commit5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b (patch)
treed16a1846265310a31d8aa02c3276306240772ce8 /buffer.c
parent1c0cc4ad89308f3cc3ea26c6e4566e6e29073de7 (diff)
downloadopenvpn-5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b.tar.gz
openvpn-5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b.tar.xz
openvpn-5d89a3629cb0fd0ca6764ba9a6d6e3d1ff61c70b.zip
Added likely() and unlikely() branch prediction hint macros
to syshead.h Introduced BUF_MAX constant to limit struct buffer offset and length values. BUF_MAX has been set to 2^20. Use likely() and unlikely() macros in buffer.h code to allow the compiler to generate more efficient code. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3058 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 03ff8fc..08f0656 100644
--- a/buffer.c
+++ b/buffer.c
@@ -54,6 +54,7 @@ alloc_buf_gc (size_t size, struct gc_arena *gc)
#endif
{
struct buffer buf;
+ ASSERT (size <= BUF_MAX);
buf.capacity = (int)size;
buf.offset = 0;
buf.len = 0;