Length of the token was already calculated by flex and stored in yyleng,
no need to implicitly call strlen() via linear_strdup().
---
 src/compiler/glsl/glcpp/glcpp-lex.l | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/glcpp/glcpp-lex.l 
b/src/compiler/glsl/glcpp/glcpp-lex.l
index 381b97364a..93e5cb3845 100644
--- a/src/compiler/glsl/glcpp/glcpp-lex.l
+++ b/src/compiler/glsl/glcpp/glcpp-lex.l
@@ -101,7 +101,8 @@ void glcpp_set_column (int  column_no , yyscan_t yyscanner);
 #define RETURN_STRING_TOKEN(token)                                     \
        do {                                                            \
                if (! parser->skipping) {                               \
-                       yylval->str = linear_strdup(yyextra->linalloc, yytext); 
\
+                       yylval->str = linear_alloc_child(yyextra->linalloc, 
yyleng + 1);        \
+                       memcpy(yylval->str, yytext, yyleng + 1);        \
                        RETURN_TOKEN_NEVER_SKIP (token);                \
                }                                                       \
        } while(0)
-- 
2.13.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to