This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document UTF8_MAXBYTES_CASE
[perl5.git] / utf8.h
diff --git a/utf8.h b/utf8.h
index 83cccf1..ded581a 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -426,14 +426,24 @@ encoded as UTF-8.  C<cp> is a native (ASCII or EBCDIC) code point if less than
  * continuation byte */
 #define MAX_PORTABLE_UTF8_TWO_BYTE (32 * (1U << 5) - 1)
 
-/* The maximum number of UTF-8 bytes a single Unicode character can
- * uppercase/lowercase/fold into.  Unicode guarantees that the maximum
- * expansion is UTF8_MAX_FOLD_CHAR_EXPAND characters, but any above-Unicode
- * code point will fold to itself, so we only have to look at the expansion of
- * the maximum Unicode code point.  But this number may be less than the space
- * occupied by a very large code point under Perl's extended UTF-8.  We have to
- * make it large enough to fit any single character.  (It turns out that ASCII
- * and EBCDIC differ in which is larger) */
+/*
+
+=for apidoc AmnU|STRLEN|UTF8_MAXBYTES_CASE
+
+The maximum number of UTF-8 bytes a single Unicode character can
+uppercase/lowercase/titlecase/fold into.
+
+=cut
+
+ * Unicode guarantees that the maximum expansion is UTF8_MAX_FOLD_CHAR_EXPAND
+ * characters, but any above-Unicode code point will fold to itself, so we only
+ * have to look at the expansion of the maximum Unicode code point.  But this
+ * number may be less than the space occupied by a very large code point under
+ * Perl's extended UTF-8.  We have to make it large enough to fit any single
+ * character.  (It turns out that ASCII and EBCDIC differ in which is larger)
+ *
+=cut
+*/
 #define UTF8_MAXBYTES_CASE                                                     \
         (UTF8_MAXBYTES >= (UTF8_MAX_FOLD_CHAR_EXPAND * OFFUNISKIP(0x10FFFF))    \
                            ? UTF8_MAXBYTES                                      \
@@ -583,7 +593,8 @@ L</C<UTF8_SAFE_SKIP>>, for example when interfacing with a C library.
 */
 
 #define UTF8_CHK_SKIP(s)                                                       \
-            (s[0] == '\0' ? 1 : MIN(my_strnlen((char *) (s), UTF8SKIP(s))))
+            (s[0] == '\0' ? 1 : MIN(UTF8SKIP(s),                               \
+                                    my_strnlen((char *) (s), UTF8SKIP(s))))
 /*
 
 =for apidoc Am|STRLEN|UTF8_SAFE_SKIP|char* s|char* e