]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: use minmax.h instead of rolling our own
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Nov 2021 05:30:38 +0000 (22:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Nov 2021 05:36:46 +0000 (22:36 -0700)
* gl/lib/mbsalign.c, gl/lib/randread.c, src/system.h (MAX, MIN):
Remove; include minmax.h instead.
* gl/modules/mbsalign, gl/modules/randread (Depends-on): Add minmax.
* src/factor.c (MIN): Remove.

gl/lib/mbsalign.c
gl/lib/randread.c
gl/modules/mbsalign
gl/modules/randread
src/factor.c
src/system.h

index 74e28ca1b60f7bc000b963bcdd588c0092dfb851..0ef9f8d129f061431e2fc111a1f48bed8ac944b6 100644 (file)
@@ -19,6 +19,8 @@
 #include <config.h>
 #include "mbsalign.h"
 
+#include "minmax.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <wchar.h>
 #include <wctype.h>
 
-#ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
 /* Replace non printable chars.
    Note \t and \n etc. are non printable.
    Return 1 if replacement made, 0 otherwise.  */
index d8c5cbaf5cb685ef328a52d778c71537df0fef92..6949783e1f7a456501660054b653f6727713fbc5 100644 (file)
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
+#include "minmax.h"
 #include "rand-isaac.h"
 #include "stdio-safer.h"
 #include "unlocked-io.h"
 #include "xalloc.h"
 
-#ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
 #if _STRING_ARCH_unaligned || _STRING_INLINE_unaligned
 # define ALIGNED_POINTER(ptr, type) true
 #else
index 7f9c9741bb3b4edd425e56554093813d65154929..c27c21225a95134bc5b56b91f416e5e80e15a653 100644 (file)
@@ -6,6 +6,7 @@ lib/mbsalign.c
 lib/mbsalign.h
 
 Depends-on:
+minmax
 wchar
 wctype
 wcwidth
index 5c682403872fde975073e6c09a425835d31e24ee..cba84db354921ae41cf93a7408e47cbbe155f770 100644 (file)
@@ -14,6 +14,7 @@ inline
 fopen-safer
 getrandom
 quote
+minmax
 stdalign
 stdbool
 stdint
index 6586ec7571c9b003f152485bfd8235f5012463cd..614f8fa15cc0be469dfa8f0b28f75990a5234453 100644 (file)
@@ -1950,7 +1950,6 @@ static const unsigned short invtab[0x81] =
 # define Q_FREQ_SIZE 50
 /* Element 0 keeps the total */
 static unsigned int q_freq[Q_FREQ_SIZE + 1];
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
 #endif
 
 #if USE_SQUFOF
index ce07ab03fcc8a15c4c7e2f820efad89ac10822ef..bc51e03590fa15705671ca08a30b33fdba6735ea 100644 (file)
@@ -380,14 +380,7 @@ enum
     exit (EXIT_SUCCESS);                                               \
     break;
 
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef MIN
-# define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
+#include "minmax.h"
 #include "intprops.h"
 
 #ifndef SSIZE_MAX