]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urldata: shrink *select_bits int => unsigned char
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Apr 2023 16:04:46 +0000 (18:04 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 26 Apr 2023 21:36:45 +0000 (23:36 +0200)
- dselect_bits
- cselect_bits

... are using less than 8 bits. Changed types and moved them towards
the end of the structs to fit better.

Closes #11025

lib/http2.c
lib/multi.c
lib/urldata.h
lib/vquic/curl_msh3.c
lib/vquic/curl_ngtcp2.c
lib/vquic/curl_quiche.c

index 62eed3c35d851bcc722899351df6aa55f2844da1..4ce618a5b1c866946dce84f921a6ac1e10d417f7 100644 (file)
@@ -193,7 +193,7 @@ static void drain_stream(struct Curl_cfilter *cf,
                          struct Curl_easy *data,
                          struct stream_ctx *stream)
 {
-  int bits;
+  unsigned char bits;
 
   (void)cf;
   bits = CURL_CSELECT_IN;
index 0be8d0c407be4a7286b19188d34b28f090332606..441435628869cf2b7abb98d41000629d4351d5ad 100644 (file)
@@ -3222,7 +3222,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
 
         if(data->conn && !(data->conn->handler->flags & PROTOPT_DIRLOCK))
           /* set socket event bitmask if they're not locked */
-          data->conn->cselect_bits = ev_bitmask;
+          data->conn->cselect_bits = (unsigned char)ev_bitmask;
 
         Curl_expire(data, 0, EXPIRE_RUN_NOW);
       }
index d93ee970693969e3567d9906d009f8178e078482..f02e6654143e1e802627c290e21b430aa9711d65 100644 (file)
@@ -1049,7 +1049,6 @@ struct connectdata {
      wrong connections. */
   char *localdev;
   unsigned short localportrange;
-  int cselect_bits; /* bitmask of socket events */
   int waitfor;      /* current READ/WRITE bits to wait for */
 #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
   int socks5_gssapi_enctype;
@@ -1065,6 +1064,7 @@ struct connectdata {
   unsigned short localport;
   unsigned short secondary_port; /* secondary socket remote port to connect to
                                     (ftp) */
+  unsigned char cselect_bits; /* bitmask of socket events */
   unsigned char alpn; /* APLN TLS negotiated protocol, a CURL_HTTP_VERSION*
                          value */
 #ifndef CURL_DISABLE_PROXY
@@ -1319,8 +1319,6 @@ struct UrlState {
   char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
   long followlocation; /* redirect counter */
   int requests; /* request counter: redirects + authentication retakes */
-  int dselect_bits; /* != 0 -> bitmask of socket events for this transfer
-                     * overriding anything the socket may report */
 #ifdef HAVE_SIGNAL
   /* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
   void (*prev_signal)(int sig);
@@ -1346,11 +1344,6 @@ struct UrlState {
 
   /* a place to store the most recently set (S)FTP entrypath */
   char *most_recent_ftp_entrypath;
-  unsigned char httpwant; /* when non-zero, a specific HTTP version requested
-                             to be used in the library's request(s) */
-  unsigned char httpversion; /* the lowest HTTP version*10 reported by any
-                                server involved in this request */
-
 #if !defined(WIN32) && !defined(MSDOS) && !defined(__EMX__)
 /* do FTP line-end conversions on most platforms */
 #define CURL_DO_LINEEND_CONV
@@ -1383,8 +1376,6 @@ struct UrlState {
   void *in;                      /* CURLOPT_READDATA */
   CURLU *uh; /* URL handle for the current parsed URL */
   struct urlpieces up;
-  unsigned char httpreq; /* Curl_HttpReq; what kind of HTTP request (if any)
-                            is this */
   char *url;        /* work URL, copied from UserDefined */
   char *referer;    /* referer string */
   struct curl_slist *resolve; /* set to point to the set.resolve list when
@@ -1425,6 +1416,15 @@ struct UrlState {
     char *proxypasswd;
   } aptr;
 
+  unsigned char httpwant; /* when non-zero, a specific HTTP version requested
+                             to be used in the library's request(s) */
+  unsigned char httpversion; /* the lowest HTTP version*10 reported by any
+                                server involved in this request */
+  unsigned char httpreq; /* Curl_HttpReq; what kind of HTTP request (if any)
+                            is this */
+  unsigned char dselect_bits; /* != 0 -> bitmask of socket events for this
+                                 transfer overriding anything the socket may
+                                 report */
 #ifdef CURLDEBUG
   BIT(conncache_lock);
 #endif
index 7d23f9f5b0d2ee050f6d22cace67657708c5f8e9..438a60d4714fefde6cc18490333254819773566b 100644 (file)
@@ -192,7 +192,7 @@ static void h3_data_done(struct Curl_cfilter *cf, struct Curl_easy *data)
 static void drain_stream_from_other_thread(struct Curl_easy *data,
                                            struct stream_ctx *stream)
 {
-  int bits;
+  unsigned char bits;
 
   /* risky */
   bits = CURL_CSELECT_IN;
@@ -208,7 +208,7 @@ static void drain_stream(struct Curl_cfilter *cf,
                          struct Curl_easy *data)
 {
   struct stream_ctx *stream = H3_STREAM_CTX(data);
-  int bits;
+  unsigned char bits;
 
   (void)cf;
   bits = CURL_CSELECT_IN;
index 6eee431cc8d8f275f998057db1267047b59988a7..c76c674444c741fd35e621ddaacf53e5bf6f99c0 100644 (file)
@@ -994,7 +994,7 @@ static void drain_stream(struct Curl_cfilter *cf,
                          struct Curl_easy *data)
 {
   struct stream_ctx *stream = H3_STREAM_CTX(data);
-  int bits;
+  unsigned char bits;
 
   (void)cf;
   bits = CURL_CSELECT_IN;
index e32cc366d7033193a15951dd52b17f1e0491dfb6..ff3f8f4ec4232fafdb909a4fd86413fd291d8132 100644 (file)
@@ -303,7 +303,7 @@ static void drain_stream(struct Curl_cfilter *cf,
                          struct Curl_easy *data)
 {
   struct stream_ctx *stream = H3_STREAM_CTX(data);
-  int bits;
+  unsigned char bits;
 
   (void)cf;
   bits = CURL_CSELECT_IN;