tidy-up: avoid using the reserved macro namespace

To avoid hitting `-Wreserved-macro-identifier` where possible.

- amigaos: introduce local macro instead of reusing `__request()`.
- easy_lock: avoid redefining `__has_builtin()`.
  Follow-up to 33fd57b8ff #9062
- rand: drop interim macro `_random()`.
- windows: rename local macro `_tcsdup()` to `Curl_tcsdup()`.
  To avoid using the reserved macro namespace and to avoid
  colliding with `_tcsdup()` as defined by Windows headers.
- checksrc: ban `_tcsdup()` in favor of `Curl_tcsdup()`.
- tool_doswin: avoid redefining `_use_lfn()` (MS-DOS).
- tool_findfile: limit `__NO_NET_API` hack to AmigaOS.
  Syncing this pattern with `lib/netrc.c`.
  Follow-up to 784a8ec2c1 #16279
- examples/http2-upload: avoid reserved namespace for local macro.

More cases will be removed when dropping WinCE support via #17927.

Cases remain when defining external macros out of curl's control.

Ref: #18477
Closes #18482
This commit is contained in:
Viktor Szakats 2025-09-05 10:44:06 +02:00
parent 096fc4325b
commit ad26a6cb99
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
16 changed files with 40 additions and 36 deletions

View file

@ -149,12 +149,6 @@ static CURLcode weak_random(struct Curl_easy *data,
}
#endif
#ifdef USE_SSL
#define _random(x,y,z) Curl_ssl_random(x,y,z)
#else
#define _random(x,y,z) weak_random(x,y,z)
#endif
static CURLcode randit(struct Curl_easy *data, unsigned int *rnd,
bool env_override)
{
@ -185,7 +179,11 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd,
#endif
/* data may be NULL! */
return _random(data, (unsigned char *)rnd, sizeof(*rnd));
#ifdef USE_SSL
return Curl_ssl_random(data, (unsigned char *)rnd, sizeof(*rnd));
#else
return weak_random(data, (unsigned char *)rnd, sizeof(*rnd));
#endif
}
/*