nghttp2_hd: fix It is odd that the body of 'hd_get_num_table_entries' function is fully equivalent to the body of 'get_max_index' function found by PVS Studio (V524)

This commit is contained in:
Alexis La Goutte 2017-01-03 21:46:41 +01:00
parent 87d1692e27
commit ae87a44b94
1 changed files with 2 additions and 6 deletions

View File

@ -2281,10 +2281,6 @@ ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *fin,
return decode_length(res, shift_ptr, fin, initial, shift, in, last, prefix); return decode_length(res, shift_ptr, fin, initial, shift, in, last, prefix);
} }
static size_t hd_get_num_table_entries(nghttp2_hd_context *context) {
return context->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH;
}
static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context, static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
size_t idx) { size_t idx) {
if (idx == 0) { if (idx == 0) {
@ -2301,7 +2297,7 @@ static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
} }
size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) { size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) {
return hd_get_num_table_entries(&deflater->ctx); return get_max_index(&deflater->ctx);
} }
const nghttp2_nv * const nghttp2_nv *
@ -2320,7 +2316,7 @@ nghttp2_hd_deflate_get_max_dynamic_table_size(nghttp2_hd_deflater *deflater) {
} }
size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) { size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) {
return hd_get_num_table_entries(&inflater->ctx); return get_max_index(&inflater->ctx);
} }
const nghttp2_nv * const nghttp2_nv *