Commit c67a30b469 for perl

commit c67a30b469de9f50dcc2d12860818c0012349d76
Author: Lukas Mai <lukasmai.403@gmail.com>
Date:   Fri Nov 27 22:22:00 2026 +0100

    utf8.h: use portable MIN/MAX macros

    Define PERL_MIN/PERL_MAX ((pro-)perly prefixed) and use them for all
    macros in utf8.h, replacing the unportable (in XS) MIN/MAX versions.

    Fixes #25120.

diff --git a/handy.h b/handy.h
index b939608f3f..d7b73af5e5 100644
--- a/handy.h
+++ b/handy.h
@@ -343,12 +343,15 @@ don't, so that you can portably take advantage of this C99 feature.
 /* Unused by core; should be deprecated */
 #define Ctl(ch) ((ch) & 037)

+#define PERL_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define PERL_MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #if defined(PERL_CORE) || defined(PERL_EXT)
 #  ifndef MIN
-#    define MIN(a,b) ((a) < (b) ? (a) : (b))
+#    define MIN(a, b) PERL_MIN(a, b)
 #  endif
 #  ifndef MAX
-#    define MAX(a,b) ((a) > (b) ? (a) : (b))
+#    define MAX(a, b) PERL_MAX(a, b)
 #  endif
 #endif

diff --git a/utf8.h b/utf8.h
index e703b62c2d..6e5f4b75fa 100644
--- a/utf8.h
+++ b/utf8.h
@@ -776,7 +776,7 @@ EBCDIC) code point if less than 256; a Unicode code point otherwise.
 /* The largest code point representable by two UTF-8 bytes on any platform that
  * Perl runs on. */
 #define MAX_PORTABLE_UTF8_TWO_BYTE                                          \
-                nBIT_UMAX(5 + MIN(       UTF_CONTINUATION_BYTE_INFO_BITS,   \
+           nBIT_UMAX(5 + PERL_MIN(       UTF_CONTINUATION_BYTE_INFO_BITS,   \
                                   UTF_EBCDIC_CONTINUATION_BYTE_INFO_BITS))

 /*
@@ -798,7 +798,7 @@ uppercase/lowercase/titlecase/fold into.
 =cut
 */
 #define UTF8_MAXBYTES_CASE                                                  \
-        MAX(UTF8_MAXBYTES, UTF8_MAX_FOLD_CHAR_EXPAND * MAX_UNICODE_UTF8_BYTES)
+    PERL_MAX(UTF8_MAXBYTES, UTF8_MAX_FOLD_CHAR_EXPAND * MAX_UNICODE_UTF8_BYTES)

 /* Rest of these are attributes of Unicode and perl's internals rather than the
  * encoding, or happen to be the same in both ASCII and EBCDIC (at least at
@@ -920,7 +920,7 @@ C<L</UTF8_SAFE_SKIP>>, for example when interfacing with a C library.
 #define UTF8_SAFE_SKIP(s, e)  (assert((e) >= (s)),                  \
                               UNLIKELY(((e) - (s)) <= 0)            \
                                ? 0                                  \
-                               : MIN(((e) - (s)), UTF8_SKIP(s)))
+                               : PERL_MIN((e) - (s), UTF8_SKIP(s)))

 /* Most code that says 'UNI_' really means the native value for code points up
  * through 255 */