changeset 17892:989ec118a093

crypto/gc: fix a -Wswitch warning Reported by Bruce Korb in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00046.html * lib/gc-gnulib.c (gc_hash_open): Fail faster if MODE is nonzero.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 07 Feb 2015 15:09:00 -0800
parents b22e5ab20959
children b24d3b77f0ad
files ChangeLog lib/gc-gnulib.c
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+	crypto/gc: fix a -Wswitch warning
+	Reported by Bruce Korb in:
+	http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00046.html
+	* lib/gc-gnulib.c (gc_hash_open): Fail faster if MODE is nonzero.
+
 2015-02-03  Pádraig Brady  <P@draigBrady.com>
 
 	gnulib-tool: fix handling of patch(1) diagnostics
--- a/lib/gc-gnulib.c
+++ b/lib/gc-gnulib.c
@@ -626,6 +626,9 @@
   _gc_hash_ctx *ctx;
   Gc_rc rc = GC_OK;
 
+  if (mode != 0)
+    return GC_INVALID_HASH;
+
   ctx = calloc (sizeof (*ctx), 1);
   if (!ctx)
     return GC_MALLOC_ERROR;
@@ -664,16 +667,6 @@
       break;
     }
 
-  switch (mode)
-    {
-    case 0:
-      break;
-
-    default:
-      rc = GC_INVALID_HASH;
-      break;
-    }
-
   if (rc == GC_OK)
     *outhandle = ctx;
   else