]> Savannah Git Hosting - gnulib.git/commitdiff
crypto/gc: fix a -Wswitch warning
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 7 Feb 2015 23:09:00 +0000 (15:09 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 7 Feb 2015 23:10:09 +0000 (15:10 -0800)
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.

ChangeLog
lib/gc-gnulib.c

index 2f2e73e0201b4b0ee283db8aa9dd7d714f11df23..82a2960e36f60d782991c7a7bfbb93843077c881 100644 (file)
--- 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
index a1276c9203885cdb431ee35e9c70a20a7f5234b9..56b466430ad96a717db01f4bb45b3476e487b351 100644 (file)
@@ -626,6 +626,9 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle)
   _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 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle)
       break;
     }
 
-  switch (mode)
-    {
-    case 0:
-      break;
-
-    default:
-      rc = GC_INVALID_HASH;
-      break;
-    }
-
   if (rc == GC_OK)
     *outhandle = ctx;
   else