From 97a02fade635f823a46b9cfa5d4bd6608d245755 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 8 Jan 2026 18:23:26 +0100 Subject: [PATCH] curl: rename a struct OutStruct field to 'regular_file' From 's_isreg'. It explains better in plain English what it is for. Closes #20222 --- src/tool_cb_hdr.c | 2 +- src/tool_cb_wrt.c | 6 +++--- src/tool_operate.c | 26 +++++++++++++------------- src/tool_sdecls.h | 6 +++--- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index 8027ea5421..573a1b7e2d 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -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! */ diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 1b76565399..daa8c24154 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -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; diff --git a/src/tool_operate.c b/src/tool_operate.c index 81cfc5dd99..19462e0f0c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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; } diff --git a/src/tool_sdecls.h b/src/tool_sdecls.h index 9a6f3cc882..aab2d71ca9 100644 --- a/src/tool_sdecls.h +++ b/src/tool_sdecls.h @@ -38,10 +38,10 @@ * '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); };