]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: rename a struct OutStruct field to 'regular_file'
authorDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jan 2026 17:23:26 +0000 (18:23 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 8 Jan 2026 21:34:05 +0000 (22:34 +0100)
From 's_isreg'. It explains better in plain English what it is for.

Closes #20222

src/tool_cb_hdr.c
src/tool_cb_wrt.c
src/tool_operate.c
src/tool_sdecls.h

index 8027ea542171b3805b4948cd8f104c5642d2ef1b..573a1b7e2d2c84c88a59a7f737abc5c6e943f594 100644 (file)
@@ -224,7 +224,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
               outs->filename = filename;
 
             outs->is_cd_filename = TRUE;
-            outs->s_isreg = TRUE;
+            outs->regular_file = TRUE;
             outs->fopened = FALSE;
             outs->alloc_filename = TRUE;
             hdrcbdata->honor_cd_filename = FALSE; /* done now! */
index 1b76565399cdecedffa47e5c09d3710a71ad8973..daa8c241541201ed335d1356df53d1ebe42b2a28 100644 (file)
@@ -99,7 +99,7 @@ bool tool_create_output_file(struct OutStruct *outs,
           curlx_strerror(errno, errbuf, sizeof(errbuf)));
     return FALSE;
   }
-  outs->s_isreg = TRUE;
+  outs->regular_file = TRUE;
   outs->fopened = TRUE;
   outs->stream = file;
   outs->bytes = 0;
@@ -282,7 +282,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
       /* regular file */
       if(!*outs->filename)
         check_fails = TRUE;
-      if(!outs->s_isreg)
+      if(!outs->regular_file)
         check_fails = TRUE;
       if(outs->fopened && !outs->stream)
         check_fails = TRUE;
@@ -293,7 +293,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
     }
     else {
       /* standard stream */
-      if(!outs->stream || outs->s_isreg || outs->fopened)
+      if(!outs->stream || outs->regular_file || outs->fopened)
         check_fails = TRUE;
       if(outs->alloc_filename || outs->is_cd_filename || outs->init)
         check_fails = TRUE;
index 81cfc5dd99e6b2ade587fa3f0299cc1d88e89e66..19462e0f0cb25234bb2dcf3bf6157e1aef79e4fd 100644 (file)
@@ -346,14 +346,14 @@ static bool is_outfile_auto_resumable(struct OperationConfig *config,
 {
   struct OutStruct *outs = &per->outs;
   return config->use_resume && config->resume_from_current &&
-         config->resume_from >= 0 && outs->init == config->resume_from &&
-         outs->bytes > 0 && outs->filename && outs->s_isreg && outs->fopened &&
-         outs->stream && !ferror(outs->stream) &&
-         !config->customrequest && !per->uploadfile &&
-         (config->httpreq == TOOL_HTTPREQ_UNSPEC ||
-          config->httpreq == TOOL_HTTPREQ_GET) &&
-         /* CURLE_WRITE_ERROR could mean outs->bytes is not accurate */
-         result != CURLE_WRITE_ERROR && result != CURLE_RANGE_ERROR;
+    config->resume_from >= 0 && outs->init == config->resume_from &&
+    outs->bytes > 0 && outs->filename && outs->regular_file && outs->fopened &&
+    outs->stream && !ferror(outs->stream) &&
+    !config->customrequest && !per->uploadfile &&
+    (config->httpreq == TOOL_HTTPREQ_UNSPEC ||
+     config->httpreq == TOOL_HTTPREQ_GET) &&
+    /* CURLE_WRITE_ERROR could mean outs->bytes is not accurate */
+    result != CURLE_WRITE_ERROR && result != CURLE_RANGE_ERROR;
 }
 
 static CURLcode retrycheck(struct OperationConfig *config,
@@ -676,7 +676,7 @@ static CURLcode post_per_transfer(struct per_transfer *per,
       result = CURLE_WRITE_ERROR;
   }
 
-  if(!outs->s_isreg && outs->stream) {
+  if(!outs->regular_file && outs->stream) {
     /* Dump standard stream buffered data */
     rc = fflush(outs->stream);
     if(!result && rc) {
@@ -731,7 +731,7 @@ static CURLcode post_per_transfer(struct per_transfer *per,
   }
 
   /* File time can only be set _after_ the file has been closed */
-  if(!result && config->remote_time && outs->s_isreg && outs->filename) {
+  if(!result && config->remote_time && outs->regular_file && outs->filename) {
     /* Ask libcurl if we got a remote file time */
     curl_off_t filetime = -1;
     curl_easy_getinfo(curl, CURLINFO_FILETIME_T, &filetime);
@@ -903,7 +903,7 @@ static CURLcode etag_store(struct OperationConfig *config,
     }
     else {
       etag_save->filename = config->etag_save_file;
-      etag_save->s_isreg = TRUE;
+      etag_save->regular_file = TRUE;
       etag_save->fopened = TRUE;
       etag_save->stream = newfile;
     }
@@ -956,7 +956,7 @@ static CURLcode setup_headerfile(struct OperationConfig *config,
     }
     else {
       heads->filename = config->headerfile;
-      heads->s_isreg = TRUE;
+      heads->regular_file = TRUE;
       heads->fopened = TRUE;
       heads->stream = newfile;
     }
@@ -1068,7 +1068,7 @@ static CURLcode setup_outfile(struct OperationConfig *config,
     outs->stream = NULL; /* open when needed */
   }
   outs->filename = per->outfile;
-  outs->s_isreg = TRUE;
+  outs->regular_file = TRUE;
   return CURLE_OK;
 }
 
index 9a6f3cc8820f62e22d9e7be1f9f4a1cecf0c9b55..aab2d71ca95e6668a49c6f3d4c7d260a730f408e 100644 (file)
  * 'is_cd_filename' member is TRUE when string pointed by 'filename' has been
  * set using a server-specified Content-Disposition filename, otherwise FALSE.
  *
- * 's_isreg' member is TRUE when output goes to a regular file, this also
+ * 'regular_file' member is TRUE when output goes to a regular file, this also
  * implies that output is 'seekable' and 'appendable' and also that member
  * 'filename' points to filename's string. For any standard stream member
- * 's_isreg' will be FALSE.
+ * 'regular_file' will be FALSE.
  *
  * 'fopened' member is TRUE when output goes to a regular file and it
  * has been fopen'ed, requiring it to be closed later on. In any other
@@ -72,7 +72,7 @@ struct OutStruct {
 #endif
   BIT(alloc_filename);
   BIT(is_cd_filename);
-  BIT(s_isreg);
+  BIT(regular_file);
   BIT(fopened);
   BIT(out_null);
 };