aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-06-01 14:34:01 -0700
committerGuy Harris <guy@alum.mit.edu>2014-06-01 21:55:37 +0000
commit090f568e6a8e8d0b44152f9aef3f57a6e6a5b1df (patch)
tree394017821b627b648f7a756c32ded1662b7a7977
parent38834084b2e93c160c48eea4eac7794af2a315b9 (diff)
Make this comple whether assertions are enabled or not.
Make the check for a valid index range a macro, so the compiler doesn't whine if it's not used, but it's available if it *is* used. Change-Id: I3cee0460eacef23187c141458dc5ac7a7acbf7c8 Reviewed-on: https://code.wireshark.org/review/1914 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--wsutil/nghttp2/nghttp2_hd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/wsutil/nghttp2/nghttp2_hd.c b/wsutil/nghttp2/nghttp2_hd.c
index 3ad97219ae..6d7b9e40f8 100644
--- a/wsutil/nghttp2/nghttp2_hd.c
+++ b/wsutil/nghttp2/nghttp2_hd.c
@@ -993,12 +993,8 @@ static void clear_refset(nghttp2_hd_context *context)
}
}
-#if 0
-static int check_index_range(nghttp2_hd_context *context, size_t idx)
-{
- return idx < context->hd_table.len + STATIC_TABLE_LENGTH;
-}
-#endif
+#define INDEX_RANGE_VALID(context, idx) \
+ ((idx) < (context)->hd_table.len + STATIC_TABLE_LENGTH)
static int get_max_index(nghttp2_hd_context *context)
{
@@ -1008,7 +1004,7 @@ static int get_max_index(nghttp2_hd_context *context)
nghttp2_hd_entry* nghttp2_hd_table_get(nghttp2_hd_context *context,
size_t idx)
{
- assert(check_index_range(context, idx));
+ assert(INDEX_RANGE_VALID(context, idx));
if(idx < context->hd_table.len) {
return hd_ringbuf_get(&context->hd_table, idx);
} else {