diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-04-28 13:09:39 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-04-28 13:10:53 +0200 |
commit | b2ea1bfcd63e32dabe2f3cfe9a48dd157ec1eb6f (patch) | |
tree | 69ad16eb354f88f5909d07c7dab89488bdc149a5 /lib | |
parent | 07412711982d7aba629893a5f6a38e9230ea7407 (diff) |
hash: simplify Curl_str_key_compare()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hash.c | 11 |
1 files 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; } |