gallium/hud: set the dump file streams to line buffered
authorEdmondo Tommasina <edmondo.tommasina@gmail.com>
Wed, 5 Apr 2017 19:03:55 +0000 (21:03 +0200)
committerJulien Isorce <jisorce@oblong.com>
Thu, 13 Apr 2017 11:38:49 +0000 (12:38 +0100)
Flush the HUD value streams to the dump files after every newline.

v2: check that fopen succeeded  (Julien)

Reviewed-and-Tested-by: Julien Isorce <jisorce@oblong.com>
src/gallium/auxiliary/hud/hud_context.c

index 29ef9eee31c6a0308339a67db46093f7e9916765..f492c81fe6dceb44ed4083ed54ecbca5847c2758 100644 (file)
@@ -972,6 +972,8 @@ hud_graph_set_dump_file(struct hud_graph *gr)
          strcat(dump_file, "/");
          strcat_without_spaces(dump_file, gr->name);
          gr->fd = fopen(dump_file, "w+");
+         if (gr->fd)
+            setvbuf(gr->fd, NULL, _IOLBF, 0);
          free(dump_file);
       }
    }