coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[INSTALLED 3/3] maint: remove unused functions and constants


From: Paul Eggert
Subject: [INSTALLED 3/3] maint: remove unused functions and constants
Date: Sat, 22 Apr 2017 02:52:34 -0700

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 3e36063..88640ae 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 e3ec841..4561067 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 91cdfb2..9de0eb9 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.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]