Mesa (main): mesa: rename locals in _mesa_program_resource_find_name for clarity
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 12:03:49 UTC 2021
Module: Mesa
Branch: main
Commit: 4b67055fef744333c892b8aaab96e765b8d1daef
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b67055fef744333c892b8aaab96e765b8d1daef
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Oct 22 20:45:13 2021 -0400
mesa: rename locals in _mesa_program_resource_find_name for clarity
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13507>
---
src/mesa/main/shader_query.cpp | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 86813470434..c89c0094bdc 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -694,8 +694,7 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
if (!_mesa_program_get_resource_name(res, &rname))
continue;
- int baselen = rname.length;
- int baselen_without_array_index = baselen;
+ int length_without_array_index = rname.length;
const char *rname_last_square_bracket = strrchr(rname.string, '[');
bool found = false;
bool rname_has_array_index_zero = false;
@@ -725,16 +724,16 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
* than the provided name's length.
*/
if (rname_last_square_bracket) {
- baselen_without_array_index -= rname_last_square_bracket - rname.string;
+ length_without_array_index -= rname_last_square_bracket - rname.string;
rname_has_array_index_zero =
(strcmp(rname_last_square_bracket, "[0]") == 0) &&
- (baselen_without_array_index == len);
+ (length_without_array_index == len);
}
- if (len >= baselen && strncmp(rname.string, name, baselen) == 0)
+ if (len >= rname.length && strncmp(rname.string, name, rname.length) == 0)
found = true;
else if (rname_has_array_index_zero &&
- strncmp(rname.string, name, baselen_without_array_index) == 0)
+ strncmp(rname.string, name, length_without_array_index) == 0)
found = true;
if (found) {
@@ -743,9 +742,9 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
case GL_SHADER_STORAGE_BLOCK:
/* Basename match, check if array or struct. */
if (rname_has_array_index_zero ||
- name[baselen] == '\0' ||
- name[baselen] == '[' ||
- name[baselen] == '.') {
+ name[rname.length] == '\0' ||
+ name[rname.length] == '[' ||
+ name[rname.length] == '.') {
return res;
}
break;
@@ -764,15 +763,15 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
case GL_COMPUTE_SUBROUTINE:
case GL_TESS_CONTROL_SUBROUTINE:
case GL_TESS_EVALUATION_SUBROUTINE:
- if (name[baselen] == '.') {
+ if (name[rname.length] == '.') {
return res;
}
FALLTHROUGH;
case GL_PROGRAM_INPUT:
case GL_PROGRAM_OUTPUT:
- if (name[baselen] == '\0') {
+ if (name[rname.length] == '\0') {
return res;
- } else if (name[baselen] == '[' &&
+ } else if (name[rname.length] == '[' &&
valid_array_index(name, len, array_index)) {
return res;
}
More information about the mesa-commit
mailing list