mirror of
https://github.com/curl/curl.git
synced 2026-08-25 19:43:33 +03:00
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:
parent
92124838c6
commit
22c45844af
6 changed files with 20 additions and 18 deletions
|
|
@ -833,14 +833,16 @@ parse_netscape(struct Cookie *co,
|
|||
if(ptr)
|
||||
*ptr = 0; /* clear it */
|
||||
|
||||
firstptr = strtok_r((char *)lineptr, "\t", &tok_buf); /* tokenize on TAB */
|
||||
/* tokenize on TAB */
|
||||
firstptr = Curl_strtok_r((char *)lineptr, "\t", &tok_buf);
|
||||
|
||||
/*
|
||||
* Now loop through the fields and init the struct we already have
|
||||
* allocated
|
||||
*/
|
||||
fields = 0;
|
||||
for(ptr = firstptr; ptr; ptr = strtok_r(NULL, "\t", &tok_buf), fields++) {
|
||||
for(ptr = firstptr; ptr;
|
||||
ptr = Curl_strtok_r(NULL, "\t", &tok_buf), fields++) {
|
||||
switch(fields) {
|
||||
case 0:
|
||||
if(ptr[0]=='.') /* skip preceding dots */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue