aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-05-23 14:57:49 -0600
committerBrian Paul <[email protected]>2014-05-28 15:06:07 -0600
commita7aca3919ba29ccdac01136fa9ba79f571bc797d (patch)
treeb928201cc61db62c36225acf129df4bed3754415 /src/glsl/ast_to_hir.cpp
parentf9cecca7a6e3d9ff231075381b88d179e153a5a4 (diff)
glsl: replace strncmp("gl_") calls with new is_gl_identifier() helper
Makes things a little easier to read. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index e06f9b413d2..f230a70a3ed 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3078,7 +3078,7 @@ validate_identifier(const char *identifier, YYLTYPE loc,
* OpenGL, and may not be declared in a shader as either a
* variable or a function."
*/
- if (strncmp(identifier, "gl_", 3) == 0) {
+ if (is_gl_identifier(identifier)) {
_mesa_glsl_error(&loc, state,
"identifier `%s' uses reserved `gl_' prefix",
identifier);
@@ -3653,7 +3653,7 @@ ast_declarator_list::hir(exec_list *instructions,
exec_list initializer_instructions;
/* Examine var name here since var may get deleted in the next call */
- bool var_is_gl_id = (strncmp(var->name, "gl_", 3) == 0);
+ bool var_is_gl_id = is_gl_identifier(var->name);
ir_variable *earlier =
get_variable_being_redeclared(var, decl->get_location(), state,
@@ -5403,7 +5403,7 @@ ast_interface_block::hir(exec_list *instructions,
ir_variable *earlier =
get_variable_being_redeclared(var, loc, state,
true /* allow_all_redeclarations */);
- if (strncmp(var->name, "gl_", 3) != 0 || earlier == NULL) {
+ if (!is_gl_identifier(var->name) || earlier == NULL) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex can only "
"include built-in variables");
@@ -5638,7 +5638,7 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
gl_FragColor_assigned = true;
else if (strcmp(var->name, "gl_FragData") == 0)
gl_FragData_assigned = true;
- else if (strncmp(var->name, "gl_", 3) != 0) {
+ else if (!is_gl_identifier(var->name)) {
if (state->stage == MESA_SHADER_FRAGMENT &&
var->data.mode == ir_var_shader_out) {
user_defined_fs_output_assigned = true;