diff --git a/source/hpack.c b/source/hpack.c index 83aee646..4deabac0 100644 --- a/source/hpack.c +++ b/source/hpack.c @@ -69,6 +69,12 @@ static bool s_header_eq(const void *a, const void *b) { return aws_byte_cursor_eq(&left->value, &right->value); } +static bool s_header_name_eq(const void *a, const void *b) { + const struct aws_byte_cursor *a_cursor = a; + const struct aws_byte_cursor *b_cursor = b; + return aws_byte_cursor_eq(a_cursor, b_cursor); +} + void aws_hpack_static_table_init(struct aws_allocator *allocator) { int result = aws_hash_table_init( @@ -86,7 +92,7 @@ void aws_hpack_static_table_init(struct aws_allocator *allocator) { allocator, s_static_header_table_size - 1, aws_hash_byte_cursor_ptr, - (aws_hash_callback_eq_fn *)aws_byte_cursor_eq, + s_header_name_eq, NULL, NULL); AWS_FATAL_ASSERT(AWS_OP_SUCCESS == result); @@ -143,7 +149,7 @@ void aws_hpack_context_init( allocator, s_hpack_dynamic_table_initial_elements, aws_hash_byte_cursor_ptr, - (aws_hash_callback_eq_fn *)aws_byte_cursor_eq, + s_header_name_eq, NULL, NULL); } diff --git a/source/http.c b/source/http.c index 2f7dfae9..9b3e32b5 100644 --- a/source/http.c +++ b/source/http.c @@ -197,6 +197,18 @@ static void s_destroy_enum_value(void *value) { aws_mem_release(enum_value->allocator, enum_value); } +static bool s_str_array_eq_ignore_case(const void *a, const void *b) { + const struct aws_byte_cursor *a_cursor = a; + const struct aws_byte_cursor *b_cursor = b; + return aws_byte_cursor_eq_ignore_case(a_cursor, b_cursor); +} + +static bool s_str_array_eq(const void *a, const void *b) { + const struct aws_byte_cursor *a_cursor = a; + const struct aws_byte_cursor *b_cursor = b; + return aws_byte_cursor_eq(a_cursor, b_cursor); +} + /** * Given array of aws_byte_cursors, init hashtable where... * Key is aws_byte_cursor* (pointing into cursor from array) and comparisons are case-insensitive. @@ -215,7 +227,7 @@ static void s_init_str_to_enum_hash_table( alloc, end_index - start_index, ignore_case ? aws_hash_byte_cursor_ptr_ignore_case : aws_hash_byte_cursor_ptr, - (aws_hash_callback_eq_fn *)(ignore_case ? aws_byte_cursor_eq_ignore_case : aws_byte_cursor_eq), + ignore_case ? s_str_array_eq_ignore_case : s_str_array_eq, NULL, s_destroy_enum_value); AWS_FATAL_ASSERT(!err);