From: Paul Eggert Date: Sat, 7 Feb 2015 23:09:00 +0000 (-0800) Subject: crypto/gc: fix a -Wswitch warning X-Git-Tag: v1.0~7166 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=bf729b4836397a4ba26c5eb05415b5edbd77b968;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 2f2e73e020..82a2960e36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-02-07 Paul Eggert + + 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 gnulib-tool: fix handling of patch(1) diagnostics 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