[PATCH 4/5] d3dcompiler: Make some string arrays const.

Henri Verbeet hverbeet at codeweavers.com
Fri May 2 05:50:18 CDT 2014


This is of course well-known by anyone writing C, but const binds to the
(immediate) left unless there's nothing there, so "const char *names[]" for
example declares an array of mutable pointers to const chars.
---
 dlls/d3dcompiler_43/hlsl.y  |    4 ++--
 dlls/d3dcompiler_43/utils.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 777fb4e..ef68547 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -46,7 +46,7 @@ void hlsl_message(const char *fmt, ...)
 
 static const char *hlsl_get_error_level_name(enum hlsl_error_level level)
 {
-    const char *names[] =
+    static const char * const names[] =
     {
         "error",
         "warning",
@@ -199,7 +199,7 @@ static void declare_predefined_types(struct hlsl_scope *scope)
 {
     struct hlsl_type *type;
     unsigned int x, y, bt;
-    static const char *names[] =
+    static const char * const names[] =
     {
         "float",
         "half",
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 221dad5..c110718 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1974,7 +1974,7 @@ const char *debug_modifiers(DWORD modifiers)
 
 static const char *debug_node_type(enum hlsl_ir_node_type type)
 {
-    const char *names[] =
+    static const char * const names[] =
     {
         "HLSL_IR_VAR",
         "HLSL_IR_ASSIGNMENT",
@@ -2080,7 +2080,7 @@ static void debug_dump_ir_constant(const struct hlsl_ir_constant *constant)
 
 static const char *debug_expr_op(const struct hlsl_ir_expr *expr)
 {
-    static const char *op_names[] =
+    static const char * const op_names[] =
     {
         "~",
         "!",
-- 
1.7.10.4




More information about the wine-patches mailing list