Mesa (master): gallium/hud: call fflush() after printing error messages

Brian Paul brianp at kemper.freedesktop.org
Thu Nov 3 20:31:02 UTC 2016


Module: Mesa
Branch: master
Commit: f4dd3bde3750c9e677eb916f846b942765febbb7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4dd3bde3750c9e677eb916f846b942765febbb7

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Nov  1 08:32:04 2016 -0600

gallium/hud: call fflush() after printing error messages

For Windows.  Otherwise, we don't see the message until the program exits.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/auxiliary/hud/hud_context.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 3772f3c..ceb157a 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -875,9 +875,12 @@ parse_string(const char *s, char *out)
 
    *out = 0;
 
-   if (*s && !i)
+   if (*s && !i) {
       fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) while "
               "parsing a string\n", *s, *s);
+      fflush(stderr);
+   }
+
    return i;
 }
 
@@ -937,6 +940,7 @@ read_pane_settings(char *str, unsigned * const x, unsigned * const y,
 
       default:
          fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *str);
+         fflush(stderr);
       }
 
    }
@@ -1139,6 +1143,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
             if (!hud_driver_query_install(&hud->batch_query, pane, hud->pipe,
                                           name)) {
                fprintf(stderr, "gallium_hud: unknown driver query '%s'\n", name);
+               fflush(stderr);
             }
          }
       }
@@ -1149,6 +1154,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
          if (!pane) {
             fprintf(stderr, "gallium_hud: syntax error: unexpected ':', "
                     "expected a name\n");
+            fflush(stderr);
             break;
          }
 
@@ -1162,6 +1168,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
          else {
             fprintf(stderr, "gallium_hud: syntax error: unexpected '%c' (%i) "
                     "after ':'\n", *env, *env);
+            fflush(stderr);
          }
       }
 
@@ -1205,6 +1212,7 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
 
       default:
          fprintf(stderr, "gallium_hud: syntax error: unexpected '%c'\n", *env);
+         fflush(stderr);
       }
 
       /* Reset to defaults for the next pane in case these were modified. */




More information about the mesa-commit mailing list