[Mesa-dev] [PATCH] mesa: remove len argument from _mesa_shader_debug()
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 27 05:16:40 PST 2015
There was only a single user which was using strlen(buf).
As this function is not user facing (i.e. we don't need to feed back
original length via a callback), we can simplify things.
Cc: Timothy Arceri <timothy.arceri at collabora.com>
Suggested-by: Timothy Arceri <timothy.arceri at collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/glsl/glsl_parser_extras.cpp | 2 +-
src/glsl/standalone_scaffolding.cpp | 2 +-
src/glsl/standalone_scaffolding.h | 2 +-
src/mesa/main/errors.c | 11 +++++------
src/mesa/main/errors.h | 2 +-
5 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 7138925..29cf0c6 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -477,7 +477,7 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
struct gl_context *ctx = state->ctx;
/* Report the error via GL_ARB_debug_output. */
- _mesa_shader_debug(ctx, type, &msg_id, msg, strlen(msg));
+ _mesa_shader_debug(ctx, type, &msg_id, msg);
ralloc_strcat(&state->info_log, "\n");
}
diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index f3e34c6..1f69d0d 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -63,7 +63,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
void
_mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
- const char *, int)
+ const char *)
{
}
diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h
index a9ca5e4..f853a18 100644
--- a/src/glsl/standalone_scaffolding.h
+++ b/src/glsl/standalone_scaffolding.h
@@ -52,7 +52,7 @@ _mesa_clear_shader_program_data(struct gl_shader_program *);
extern "C" void
_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
- const char *msg, int len);
+ const char *msg);
static inline gl_shader_stage
_mesa_shader_enum_to_shader_stage(GLenum v)
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 366b119..85e5bbd 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -1599,20 +1599,19 @@ _mesa_log(const char *fmtString, ...)
* \param ctx GL context.
* \param type The namespace to which this message belongs.
* \param id The message ID within the given namespace.
- * \param msg The message to output. Need not be null-terminated.
- * \param len The length of 'msg'. If negative, 'msg' must be null-terminated.
+ * \param msg The message to output. Must be null-terminated.
*/
void
-_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint *id,
- const char *msg, int len )
+_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
+ const char *msg)
{
enum mesa_debug_source source = MESA_DEBUG_SOURCE_SHADER_COMPILER;
enum mesa_debug_severity severity = MESA_DEBUG_SEVERITY_HIGH;
+ int len;
debug_get_id(id);
- if (len < 0)
- len = strlen(msg);
+ len = strlen(msg);
/* Truncate the message if necessary. */
if (len >= MAX_DEBUG_MESSAGE_LENGTH)
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index 81e47a8..f291976 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -115,7 +115,7 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname);
extern void
_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
- const char *msg, int len);
+ const char *msg);
void GLAPIENTRY
_mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id,
--
2.6.2
More information about the mesa-dev
mailing list