SF.net SVN: gar:[23749] csw/mgar/pkg/coreutils/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Jun 1 22:24:43 CEST 2014


Revision: 23749
          http://sourceforge.net/p/gar/code/23749
Author:   bdwalton
Date:     2014-06-01 20:24:40 +0000 (Sun, 01 Jun 2014)
Log Message:
-----------
coreutils/trunk: work around another compiler error by initializing a variable in every case

Modified Paths:
--------------
    csw/mgar/pkg/coreutils/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-get_dev-Initialize-variable-v-to-NULL-to-av.patch

Modified: csw/mgar/pkg/coreutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/coreutils/trunk/Makefile	2014-06-01 20:10:39 UTC (rev 23748)
+++ csw/mgar/pkg/coreutils/trunk/Makefile	2014-06-01 20:24:40 UTC (rev 23749)
@@ -37,8 +37,8 @@
 PATCHFILES += 0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch
 PATCHFILES += 0003-Only-define-the-out-label-if-it-will-be-used.patch
 PATCHFILES += 0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch
+PATCHFILES += 0005-src-df.c-get_dev-Initialize-variable-v-to-NULL-to-av.patch
 
-
 # We define upstream file regex so we can be notifed of new upstream
 # software release
 UFILES_REGEX = $(NAME)-(\d+(?:\.\d+)*).tar.gz

Added: csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-get_dev-Initialize-variable-v-to-NULL-to-av.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-get_dev-Initialize-variable-v-to-NULL-to-av.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-get_dev-Initialize-variable-v-to-NULL-to-av.patch	2014-06-01 20:24:40 UTC (rev 23749)
@@ -0,0 +1,39 @@
+From 3497db4f2ed62a01de46e75ab95ad3e77822e427 Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sun, 1 Jun 2014 22:21:47 +0200
+Subject: [PATCH] src/df.c:get_dev: Initialize variable v to NULL to avoid
+ warning
+
+Gcc 4.9.0 complained that v may have been used prior to
+initialization. To avoid this, initialize to NULL.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ src/df.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/df.c b/src/df.c
+index 969670e..2431626 100644
+--- a/src/df.c
++++ b/src/df.c
+@@ -921,7 +921,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:
+@@ -931,7 +931,7 @@ get_dev (char const *disk, char const *mount_point, char const* file,
+           v = &inode_values;
+           break;
+         case OTHER_FLD:
+-          v = NULL;
++	  /* Rely on the NULL initialization. */
+           break;
+         default:
+           assert (!"bad field_type");
+-- 
+1.8.4.1
+

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list