[Mesa-dev] [PATCH 18/28] use util_strcasecmp in places that may be compiled on msvc
Dylan Baker
dylan at pnwbakers.com
Fri Nov 9 18:40:11 UTC 2018
This is the same as the one defined in imports.h, but from utils.
XXX: needs to be compiled with msvc
---
src/compiler/glsl/glsl_parser.yy | 3 ++-
src/mesa/main/imports.h | 4 ----
src/util/debug.c | 9 +++++----
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index ddb54f4a4d6..d295ceece92 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -33,6 +33,7 @@
#include "glsl_parser_extras.h"
#include "compiler/glsl_types.h"
#include "main/context.h"
+#include "util/u_string.h"
#ifdef _MSC_VER
#pragma warning( disable : 4065 ) // switch statement contains 'default' but no 'case' labels
@@ -74,7 +75,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
if (state->es_shader)
return strcmp(s1, s2);
else
- return strcasecmp(s1, s2);
+ return util_strcasecmp(s1, s2);
}
%}
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 165a9ce05e1..7d210fd752e 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -81,10 +81,6 @@ extern "C" {
typedef union { GLfloat f; GLint i; GLuint u; } fi_type;
-
-#if defined(_MSC_VER)
-#define strcasecmp(s1, s2) _stricmp(s1, s2)
-#endif
/*@}*/
diff --git a/src/util/debug.c b/src/util/debug.c
index 98b1853325d..e6424ff6376 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "main/macros.h"
#include "debug.h"
+#include "util/u_string.h"
uint64_t
parse_debug_string(const char *debug,
@@ -65,12 +66,12 @@ env_var_as_boolean(const char *var_name, bool default_value)
return default_value;
if (strcmp(str, "1") == 0 ||
- strcasecmp(str, "true") == 0 ||
- strcasecmp(str, "yes") == 0) {
+ util_strcasecmp(str, "true") == 0 ||
+ util_strcasecmp(str, "yes") == 0) {
return true;
} else if (strcmp(str, "0") == 0 ||
- strcasecmp(str, "false") == 0 ||
- strcasecmp(str, "no") == 0) {
+ util_strcasecmp(str, "false") == 0 ||
+ util_strcasecmp(str, "no") == 0) {
return false;
} else {
return default_value;
--
2.19.1
More information about the mesa-dev
mailing list