summaryrefslogtreecommitdiff
path: root/lib/gc-gnulib.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-02-07 15:09:00 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-02-07 15:10:09 -0800
commitbf729b4836397a4ba26c5eb05415b5edbd77b968 (patch)
treef485fd63332555c8de260d42afb97aab4fe924f8 /lib/gc-gnulib.c
parentffb3016337a14915cba1940d911107b60b496160 (diff)
downloadgnulib-bf729b4836397a4ba26c5eb05415b5edbd77b968.tar.gz
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.
Diffstat (limited to 'lib/gc-gnulib.c')
-rw-r--r--lib/gc-gnulib.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c
index a1276c9203..56b466430a 100644
--- a/lib/gc-gnulib.c
+++ b/lib/gc-gnulib.c
@@ -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