I noticed that src/comm.c #define's min. Since system.h includes
gnulib's minmax.h we can just remove it and use that.

Pretty pointless, but might as well remove the duplication. :)

Collin
From 66af203c4da9834da22787b46be9cc610f7f8b6c Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 12 Mar 2024 10:48:38 -0700
Subject: [PATCH] maint: prefer minmax.h instead of defining our own

* src/comm.c (min): Remove.
(compare_files): Use MIN which is defined in system.h.
---
 src/comm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/comm.c b/src/comm.c
index 8c74df7d0..cb58efc8f 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -36,10 +36,6 @@
   proper_name ("Richard M. Stallman"), \
   proper_name ("David MacKenzie")
 
-/* Undefine, to avoid warning about redefinition on some systems.  */
-#undef min
-#define min(x, y) ((x) < (y) ? (x) : (y))
-
 /* True if the LC_COLLATE locale is hard.  */
 static bool hard_LC_COLLATE;
 
@@ -319,7 +315,7 @@ compare_files (char **infiles)
                               thisline[1]->buffer, thisline[1]->length - 1);
           else
             {
-              size_t len = min (thisline[0]->length, thisline[1]->length) - 1;
+              size_t len = MIN (thisline[0]->length, thisline[1]->length) - 1;
               order = memcmp (thisline[0]->buffer, thisline[1]->buffer, len);
               if (order == 0)
                 order = ((thisline[0]->length > thisline[1]->length)
-- 
2.44.0

Reply via email to