From 28b677c0148717024996dbce418d5de2d2e76507 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 22 Apr 2017 02:46:46 -0700 Subject: [PATCH] maint: remove unused functions and constants These were found by clang. * gl/lib/rand-isaac.c (min): * gl/lib/randint.c (shift_right): * src/md5sum.c (algorithm): Remove; unused. --- gl/lib/rand-isaac.c | 7 ------- gl/lib/randint.c | 13 +++---------- src/md5sum.c | 8 ++------ 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/gl/lib/rand-isaac.c b/gl/lib/rand-isaac.c index 3e360632ba..88640aeb00 100644 --- a/gl/lib/rand-isaac.c +++ b/gl/lib/rand-isaac.c @@ -48,13 +48,6 @@ __attribute__ ((__no_sanitize_undefined__)) #endif -/* The minimum of two sizes A and B. */ -static inline size_t -min (size_t a, size_t b) -{ - return (a < b ? a : b); -} - /* A if 32-bit ISAAC, B if 64-bit. This is a macro, not an inline function, to prevent undefined behavior if the unused argument shifts by more than a word width. */ diff --git a/gl/lib/randint.c b/gl/lib/randint.c index e3ec8415a9..4561067e84 100644 --- a/gl/lib/randint.c +++ b/gl/lib/randint.c @@ -106,13 +106,6 @@ static inline randint shift_left (randint x) return HUGE_BYTES ? 0 : x << CHAR_BIT; } -/* Return X shifted right by CHAR_BIT bits. */ -static inline randint -shift_right (randint x) -{ - return HUGE_BYTES ? 0 : x >> CHAR_BIT; -} - /* Consume random data from *S to generate a random number in the range 0 .. GENMAX. */ @@ -148,9 +141,9 @@ randint_genmax (struct randint_source *s, randint genmax) /* Increase RANDMAX by appending random bytes to RANDNUM and UCHAR_MAX to RANDMAX until RANDMAX is no less than GENMAX. This may lose up to CHAR_BIT bits of information - if shift_right (RANDINT_MAX) < GENMAX, but it is not - worth the programming hassle of saving these bits since - GENMAX is rarely that large in practice. */ + if (HUGE_BYTES ? 0 : RANDINT_MAX >> CHAR_BIT) < GENMAX, + but it is not worth the programming hassle of saving + these bits since GENMAX is rarely that large in practice. */ i = 0; diff --git a/src/md5sum.c b/src/md5sum.c index 91cdfb24f7..9de0eb9217 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -170,12 +170,8 @@ enum Algorithm { BLAKE2b }; -static enum Algorithm const algorithm[] = -{ - BLAKE2b -}; -ARGMATCH_VERIFY (algorithm_in_string, algorithm); -ARGMATCH_VERIFY (algorithm_out_string, algorithm); +verify (ARRAY_CARDINALITY (algorithm_in_string) == 2); +verify (ARRAY_CARDINALITY (algorithm_out_string) == 2); static enum Algorithm b2_algorithm; static uintmax_t b2_length; -- 2.47.2