strtok: use namespaced strtok_r macro instead of redefining it

krb5 defines `strtok_r` for Windows unconditionally in its public
header:
dc5554394e/src/include/win-mac.h (L214-L215)
resulting in this warning:
```
lib\strtok.h(31,9): warning C4005: 'strtok_r': macro redefinition
      C:\vcpkg\installed\x64-windows\include\win-mac.h(215,9):
      see previous definition of 'strtok_r'
```

The krb5 macro collides with curl's internal definition, in case
the `strtok_r` function is undetected and falling back to a local
replacement.

Reported-by: Tal Regev
Bug: https://github.com/curl/curl/pull/15549#issuecomment-2468251761
Closes #15564
This commit is contained in:
Viktor Szakats 2024-11-12 13:37:33 +01:00
parent 92124838c6
commit 22c45844af
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 20 additions and 18 deletions

View file

@ -365,7 +365,7 @@ static CURLcode trc_opt(const char *config)
if(!tmp)
return CURLE_OUT_OF_MEMORY;
token = strtok_r(tmp, ", ", &tok_buf);
token = Curl_strtok_r(tmp, ", ", &tok_buf);
while(token) {
switch(*token) {
case '-':
@ -391,7 +391,7 @@ static CURLcode trc_opt(const char *config)
else
trc_apply_level_by_name(token, lvl);
token = strtok_r(NULL, ", ", &tok_buf);
token = Curl_strtok_r(NULL, ", ", &tok_buf);
}
free(tmp);
return CURLE_OK;