On 2010-09-27 06:32, Ramiro Polla wrote: > At first I tried using a naive wrapper of strtok_r() around strtok() > but I've been bitten by the reentrancy issue. It involved that > function that hashes multiple commands and find_executable. I'm > certain my version works, but I'm certain it's a hack too =). I don't > really mind which replacement is used as long as it works and the > functions it uses exist/work as expected on win32. I've checked > quickly and all of strspn, strpbrk, and strchr seem to be available on > windows.
Right. Now I've actually read your version and I see no problem except that it requires *saveptr == NULL on the first invocation, which the real strtok_r doesn't. But if I'm not mistaken, that's easily fixed like this: --- a/util.c +++ b/util.c @@ -176,7 +176,7 @@ strtok_r(char *str, const char *delim, char **saveptr) { int len; char *ret; - if (*saveptr) + if (!str) str = *saveptr; len = strlen(str); ret = strtok(str, delim); I've applied your patch and the above tweak. -- Joel _______________________________________________ ccache mailing list ccache@lists.samba.org https://lists.samba.org/mailman/listinfo/ccache