Mesa (mesa_7_7_branch): progs/glsl: Provide a better fix for fgets warning.

Vinson Lee vlee at kemper.freedesktop.org
Wed Dec 30 20:39:50 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 5b2713c92a89fc6c47c3546d36eeb549e126ebc0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b2713c92a89fc6c47c3546d36eeb549e126ebc0

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Dec 30 12:38:21 2009 -0800

progs/glsl: Provide a better fix for fgets warning.

---

 progs/glsl/shtest.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index 3c79543..e9800c3 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -492,11 +492,8 @@ ReadConfigFile(const char *filename, struct config_file *conf)
    conf->num_uniforms = 0;
 
    /* ugly but functional parser */
-   while (!feof(f)) {
-      char *result;
-      result = fgets(line, sizeof(line), f);
-      (void) result;
-      if (!feof(f) && line[0]) {
+   while (fgets(line, sizeof(line), f) != NULL) {
+      if (line[0]) {
          if (strncmp(line, "vs ", 3) == 0) {
             VertShaderFile = strdup(line + 3);
             VertShaderFile[strlen(VertShaderFile) - 1] = 0;




More information about the mesa-commit mailing list