From b2ea1bfcd63e32dabe2f3cfe9a48dd157ec1eb6f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 Apr 2015 13:09:39 +0200 Subject: [PATCH] hash: simplify Curl_str_key_compare() --- lib/hash.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/hash.c b/lib/hash.c index 76a7d2bb6..af2887758 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -306,16 +306,11 @@ size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num) return (h % slots_num); } -size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len) +size_t Curl_str_key_compare(void *k1, size_t key1_len, + void *k2, size_t key2_len) { - char *key1 = (char *)k1; - char *key2 = (char *)k2; - - if(key1_len == key2_len && - *key1 == *key2 && - memcmp(key1, key2, key1_len) == 0) { + if((key1_len == key2_len) && !memcmp(k1, k2, key1_len)) return 1; - } return 0; }