]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urldata: store ip version in a single byte
authorDaniel Stenberg <daniel@haxx.se>
Tue, 26 Jan 2021 13:59:01 +0000 (14:59 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 Jan 2021 08:19:12 +0000 (09:19 +0100)
Closes #6534

lib/connect.c
lib/setopt.c
lib/urldata.h

index 236fece0743c3521df02dd6e1fd3ba5429ba9713..1e9434bb6b00a36032b53be18cfd276f43152b20 100644 (file)
@@ -348,7 +348,7 @@ static CURLcode bindlocal(struct Curl_easy *data,
        * of the connection. The resolve functions should really be changed
        * to take a type parameter instead.
        */
-      long ipver = conn->ip_version;
+      unsigned char ipver = conn->ip_version;
       int rc;
 
       if(af == AF_INET)
index 409234fcd56ae3cc92e37dc5056292717f62d619..37e122f9cce90b53e493866153164d3a7061ffdc 100644 (file)
@@ -2271,7 +2271,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
     arg = va_arg(param, long);
     if((arg < CURL_IPRESOLVE_WHATEVER) || (arg > CURL_IPRESOLVE_V6))
       return CURLE_BAD_FUNCTION_ARGUMENT;
-    data->set.ipver = arg;
+    data->set.ipver = (unsigned char) arg;
     break;
 
   case CURLOPT_MAXFILESIZE_LARGE:
index d7bc3d785dba5694ed667c2dd912b47545c3207f..0d8703a4b0d723ddc41120c98f401ca85899f3f9 100644 (file)
@@ -976,6 +976,7 @@ struct connectdata {
      these are updated with data which comes directly from the socket. */
 
   char primary_ip[MAX_IPADR_LEN];
+  unsigned char ip_version; /* copied from the Curl_easy at creation time */
 
   char *user;    /* user name string, allocated */
   char *passwd;  /* password string, allocated */
@@ -1027,8 +1028,6 @@ struct connectdata {
   const struct Curl_handler *handler; /* Connection's protocol handler */
   const struct Curl_handler *given;   /* The protocol first given */
 
-  long ip_version; /* copied from the Curl_easy at creation time */
-
   /* Protocols can use a custom keepalive mechanism to keep connections alive.
      This allows those protocols to track the last time the keepalive mechanism
      was used on this connection. */
@@ -1726,8 +1725,8 @@ struct UserDefined {
                                 keep it >= CURL_MAX_WRITE_SIZE */
   void *private_data; /* application-private data */
   struct curl_slist *http200aliases; /* linked list of aliases for http200 */
-  long ipver; /* the CURL_IPRESOLVE_* defines in the public header file
-                 0 - whatever, 1 - v2, 2 - v6 */
+  unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header
+                          file 0 - whatever, 1 - v2, 2 - v6 */
   curl_off_t max_filesize; /* Maximum file size to download */
 #ifndef CURL_DISABLE_FTP
   curl_ftpfile ftp_filemethod; /* how to get to a file when FTP is used  */