summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-04-06 14:19:39 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-04-06 14:19:39 +0200
commit62e74b95a89ef6c5f19eb8c58059982b709a8307 (patch)
tree8dd0982ecac90d7fede5d1bd54607fb5d026c3dd
parent746479adcbd2bba06077642fefe0414ad6e1e0ea (diff)
downloadcurl-bagder/hash-size_t.tar.gz
hash: calculate sizes with size_t instead of longsbagder/hash-size_t
... since they return size_t anyway!
-rw-r--r--lib/cookie.c4
-rw-r--r--lib/hash.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 5aa959690..9c90c2a38 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -270,11 +270,11 @@ static const char *get_top_domain(const char * const domain, size_t *outlen)
static size_t cookie_hash_domain(const char *domain, const size_t len)
{
const char *end = domain + len;
- unsigned long h = 5381;
+ size_t h = 5381;
while(domain < end) {
h += h << 5;
- h ^= (unsigned long) Curl_raw_toupper(*domain++);
+ h ^= Curl_raw_toupper(*domain++);
}
return (h % COOKIE_HASH_SIZE);
diff --git a/lib/hash.c b/lib/hash.c
index c99b1b699..15a128fec 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -261,11 +261,11 @@ size_t Curl_hash_str(void *key, size_t key_length, size_t slots_num)
{
const char *key_str = (const char *) key;
const char *end = key_str + key_length;
- unsigned long h = 5381;
+ size_t h = 5381;
while(key_str < end) {
h += h << 5;
- h ^= (unsigned long) *key_str++;
+ h ^= *key_str++;
}
return (h % slots_num);