[Mesa-dev] [PATCH 6/9] glsl: consolidate error/warning code

nobled nobled at dreamwidth.org
Fri Apr 13 08:52:08 PDT 2012


---
 src/glsl/linker.cpp |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 49b6b8f..e2a5ef9 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -172,14 +172,23 @@ private:
 };


+static void
+linker_msg(gl_shader_program *prog, bool error, const char *fmt, va_list ap)
+{
+
+   ralloc_strcat(&prog->InfoLog, error ? "error: " : "warning: ");
+   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+
+}
+
+
 void
 linker_error(gl_shader_program *prog, const char *fmt, ...)
 {
    va_list ap;

-   ralloc_strcat(&prog->InfoLog, "error: ");
    va_start(ap, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+   linker_msg(prog, true, fmt, ap);
    va_end(ap);

    prog->LinkStatus = false;
@@ -191,11 +200,9 @@ linker_warning(gl_shader_program *prog, const
char *fmt, ...)
 {
    va_list ap;

-   ralloc_strcat(&prog->InfoLog, "error: ");
    va_start(ap, fmt);
-   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+   linker_msg(prog, false, fmt, ap);
    va_end(ap);
-
 }


-- 
1.7.4.1


More information about the mesa-dev mailing list