Subject: [PATCH] df: Initialize a variable to squash a compiler warning
From: Ben Walton <[email-masked]>
To: [email-masked]
Cc: Ben Walton <[email-masked]>
Date: Mon, 2 Jun 2014 09:09:30 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

* src/df.c: get_dev - With strict error checking, gcc complained that
            v may have been used prior to initialization. To avoid
            this, initialize to NULL.

Signed-off-by: Ben Walton <[email-masked]>
---
 src/df.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/df.c b/src/df.c
index 01ecca6..059c958 100644
--- a/src/df.c
+++ b/src/df.c
@@ -924,7 +924,7 @@ get_dev (char const *disk, char const *mount_point, char const* file,
       char buf[LONGEST_HUMAN_READABLE + 2];
       char *cell;
 
-      struct field_values_t *v;
+      struct field_values_t *v = NULL;
       switch (columns[col]->field_type)
         {
         case BLOCK_FLD:
@@ -934,7 +934,7 @@ get_dev (char const *disk, char const *mount_point, char const* file,
           v = &inode_values;
           break;
         case OTHER_FLD:
-          v = NULL;
+          /* Rely on NULL initialization. */
           break;
         default:
           assert (!"bad field_type");
-- 
1.9.1