changeset 12218:751d5b272c72

exclude: make more robust * lib/exclude.c (excluded_file_name): Abort on unexpected value, rather than masking a coding bug. Suggested by Bruno Haible. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Fri, 30 Oct 2009 06:48:14 -0600
parents e9550a750583
children cbf8d59f676a
files ChangeLog lib/exclude.c
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-10-30  Eric Blake  <ebb9@byu.net>
+
+	exclude: make more robust
+	* lib/exclude.c (excluded_file_name): Abort on unexpected value,
+	rather than masking a coding bug.
+	Suggested by Bruno Haible.
+
 2009-10-30  Jim Meyering  <meyering@redhat.com>
 
 	perl scripts: remove #!/usr/bin/perl in favor of more portable...
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -412,9 +412,7 @@
      excluded to included or vice versa.  */
   for (seg = ex->head; seg; seg = seg->next)
     {
-      /* Pacify gcc, so it doesn't issue a spurious
-	 "may be used uninitialized" warning.  */
-      bool rc = excluded;
+      bool rc;
 
       switch (seg->type)
 	{
@@ -427,6 +425,9 @@
 	    filename = xmalloc (strlen (f) + 1);
 	  rc = excluded_file_name_p (seg, f, filename);
 	  break;
+
+	default:
+	  abort ();
 	}
       if (rc != excluded)
 	{