From c9b6371977d091f9e9087b6247d8e97d0df30606 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Mon, 16 Jun 2014 18:52:11 +0200 Subject: [PATCH] When assertions is disable, there is a warning about unused check_index_range function 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. --- lib/nghttp2_hd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index 431dee5e..c9335a4c 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -993,10 +993,8 @@ static void clear_refset(nghttp2_hd_context *context) } } -static int check_index_range(nghttp2_hd_context *context, size_t idx) -{ - return idx < context->hd_table.len + STATIC_TABLE_LENGTH; -} +#define INDEX_RANGE_VALID(context, idx) \ + ((idx) < (context)->hd_table.len + STATIC_TABLE_LENGTH) static size_t get_max_index(nghttp2_hd_context *context) { @@ -1006,7 +1004,7 @@ static size_t 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 {