]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: bump hash sizes to `size_t`
authorViktor Szakats <commit@vsz.me>
Sun, 5 May 2024 15:45:11 +0000 (17:45 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 12 May 2024 16:53:09 +0000 (18:53 +0200)
Follow-up to cc907e80a2498c0599253271a6f657f614b52a4e #13502
Cherry-picked from #13489
Closes #13601

lib/conncache.c
lib/conncache.h
lib/hostip.c
lib/hostip.h
lib/multi.c
lib/multiif.h

index da9c4f032a5e41de90caadda927de13e28ab1be3..2b5ee4f25f8fa5a38b853c574347a664205d5834 100644 (file)
@@ -100,7 +100,7 @@ static void free_bundle_hash_entry(void *freethis)
   bundle_destroy(b);
 }
 
-int Curl_conncache_init(struct conncache *connc, int size)
+int Curl_conncache_init(struct conncache *connc, size_t size)
 {
   /* allocate a new easy handle to use when closing cached connections */
   connc->closure_handle = curl_easy_init();
index c60f8449eeb5eeb9fc9d3fe09b51be1f22ad7335..e68512394847c8ba9dee945015b7d10ee2f30143 100644 (file)
@@ -85,7 +85,7 @@ struct connectbundle {
 };
 
 /* returns 1 on error, 0 is fine */
-int Curl_conncache_init(struct conncache *, int size);
+int Curl_conncache_init(struct conncache *, size_t size);
 void Curl_conncache_destroy(struct conncache *connc);
 
 /* return the correct bundle, to a host or a proxy */
index 801de5ce43bc1168dd13a3a34e574f9c0cd1478e..2bd5dbfa0257e5fe40b56b9d5d6ec6e540c474be 100644 (file)
@@ -1094,7 +1094,7 @@ static void freednsentry(void *freethis)
 /*
  * Curl_init_dnscache() inits a new DNS cache.
  */
-void Curl_init_dnscache(struct Curl_hash *hash, int size)
+void Curl_init_dnscache(struct Curl_hash *hash, size_t size)
 {
   Curl_hash_init(hash, size, Curl_hash_str, Curl_str_key_compare,
                  freednsentry);
index 3ccf4354fe2632db7ee93d63d17c08cf38530c82..bf4e94d2fa1d95474ee3937ad7ed4907c7886afa 100644 (file)
@@ -166,7 +166,7 @@ void Curl_resolv_unlock(struct Curl_easy *data,
                         struct Curl_dns_entry *dns);
 
 /* init a new dns cache */
-void Curl_init_dnscache(struct Curl_hash *hash, int hashsize);
+void Curl_init_dnscache(struct Curl_hash *hash, size_t hashsize);
 
 /* prune old entries from the DNS cache */
 void Curl_hostcache_prune(struct Curl_easy *data);
index 2a4a09dae30033e3299bf62b7bbad6e8e8fd0f14..6bbdfe26721d14d40adddf48f852fd002092b757 100644 (file)
@@ -364,7 +364,7 @@ static size_t hash_fd(void *key, size_t key_length, size_t slots_num)
  * per call."
  *
  */
-static void sh_init(struct Curl_hash *hash, int hashsize)
+static void sh_init(struct Curl_hash *hash, size_t hashsize)
 {
   Curl_hash_init(hash, hashsize, hash_fd, fd_key_compare,
                  sh_freeentry);
@@ -381,9 +381,9 @@ static void multi_addmsg(struct Curl_multi *multi, struct Curl_message *msg)
   Curl_llist_append(&multi->msglist, msg, &msg->list);
 }
 
-struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
-                                     int chashsize, /* connection hash */
-                                     int dnssize) /* dns hash */
+struct Curl_multi *Curl_multi_handle(size_t hashsize, /* socket hash */
+                                     size_t chashsize, /* connection hash */
+                                     size_t dnssize) /* dns hash */
 {
   struct Curl_multi *multi = calloc(1, sizeof(struct Curl_multi));
 
index f36e14624a15a6c5fca3301a551c98e93ddda48e..59a30646c17255023304e693a49708663a21a49d 100644 (file)
@@ -45,8 +45,9 @@ void Curl_multi_connchanged(struct Curl_multi *multi);
 
 /* Internal version of curl_multi_init() accepts size parameters for the
    socket, connection and dns hashes */
-struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize,
-                                     int dnssize);
+struct Curl_multi *Curl_multi_handle(size_t hashsize,
+                                     size_t chashsize,
+                                     size_t dnssize);
 
 /* the write bits start at bit 16 for the *getsock() bitmap */
 #define GETSOCK_WRITEBITSTART 16