build: tidy up curl-specific fstat calls and stat struct type

To avoid redefining the `fstat` system symbol, and to clarify
`struct_stat` is a curl symbol.

- introduce `curlx_fstat()` macro and use it.
- rename `struct_stat` to `curl_struct_stat`.

Also:
- tests: replace direct `curlx_win32_stat()` call with `curlx_stat()`.
- checksrc: disallow direct `_fstati64` and `fstat()` calls, except in
  examples.

Closes #20496
This commit is contained in:
Viktor Szakats 2026-02-02 13:14:30 +01:00
parent 9630593650
commit a84b041281
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
22 changed files with 53 additions and 50 deletions

View file

@ -107,7 +107,7 @@ static const char aschex[] =
* and CD/DVD images should be either a STREAM_LF format or a fixed format.
*
*/
curl_off_t VmsRealFileSize(const char *name, const struct_stat *stat_buf)
curl_off_t VmsRealFileSize(const char *name, const curl_struct_stat *stat_buf)
{
char buffer[8192];
curl_off_t count;
@ -136,7 +136,8 @@ curl_off_t VmsRealFileSize(const char *name, const struct_stat *stat_buf)
* if not to call a routine to get the correct size.
*
*/
static curl_off_t VmsSpecialSize(const char *name, const struct_stat *stat_buf)
static curl_off_t VmsSpecialSize(const char *name,
const curl_struct_stat *stat_buf)
{
switch(stat_buf->st_fab_rfm) {
case FAB$C_VAR:
@ -160,7 +161,7 @@ static curl_off_t VmsSpecialSize(const char *name, const struct_stat *stat_buf)
*/
static FILE *vmsfopenread(const char *file, const char *mode)
{
struct_stat statbuf;
curl_struct_stat statbuf;
int result;
result = curlx_stat(file, &statbuf);
@ -1307,7 +1308,7 @@ CURLcode curl_mime_filedata(curl_mimepart *part, const char *filename)
if(filename) {
char *base;
struct_stat sbuf;
curl_struct_stat sbuf;
if(curlx_stat(filename, &sbuf))
result = CURLE_READ_ERROR;