]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: prefer minmax.h instead of defining our own
authorCollin Funk <collin.funk1@gmail.com>
Tue, 12 Mar 2024 17:48:38 +0000 (10:48 -0700)
committerPádraig Brady <P@draigBrady.com>
Tue, 12 Mar 2024 20:04:56 +0000 (20:04 +0000)
* src/comm.c (min): Remove.
(compare_files): Use MIN which is referenced by system.h.

src/comm.c

index 8c74df7d0de9db11d1a06ca7944a69a3c954f0cd..cb58efc8fe3aaa16ee11bc88a420e6572951b9a5 100644 (file)
   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)