[Mesa-dev] [PATCH 20/28] move windows strtok_r define to u_string

Dylan Baker dylan at pnwbakers.com
Fri Nov 9 18:40:13 UTC 2018


This makes more sense for it, it's only used in the glsl compiler
currently, so we could probably move it there, but this seems fine for a
header only #define.
---
 src/mesa/main/imports.h | 4 ----
 src/util/u_string.h     | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index b2f6fe22bc9..555abda6983 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -125,10 +125,6 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
                     unsigned long alignment);
 
 
-#if defined(_WIN32) && !defined(strtok_r)
-#define strtok_r strtok_s
-#endif
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/util/u_string.h b/src/util/u_string.h
index e4081466459..e3ac3a5879f 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -206,6 +206,10 @@ util_strstr(const char *haystack, const char *needle)
 #define util_strcasecmp stricmp
 #define util_strdup _strdup
 
+#if !defined(strtok_r)
+#define strtok_r strtok_s
+#endif
+
 #else
 
 #define util_vsnprintf vsnprintf
-- 
2.19.1



More information about the mesa-dev mailing list