Browse Source

Workaround bug in MinGW-w64: Check for strtok_r to be defined at compile-time, and don't override it unless we really want to override

MinGW-w64 #defines strtok_r in pthread.h instead of string.h where it's supposed to be (causing the configure check to fail)
This workaround has a limitation: it could result in two different files using different strtok_r implementations; if so, and they share saveptr, it's possible the two implementations may work differently and conflict in their understanding of saveptr
Luke Dashjr 12 years ago
parent
commit
ba3dae8f2a
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lib/string.in.h

+ 2 - 0
lib/string.in.h

@@ -640,6 +640,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
            characters are ASCII characters < 0x30.
 
    See also strsep().  */
+#if (!defined(strtok_r)) || @REPLACE_STRTOK_R@
 #if @GNULIB_STRTOK_R@
 # if @REPLACE_STRTOK_R@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -680,6 +681,7 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
                  "use gnulib module strtok_r for portability");
 # endif
 #endif
+#endif
 
 
 /* The following functions are not specified by POSIX.  They are gnulib