This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make is_utf8_char_buf() a macro
authorKarl Williamson <khw@cpan.org>
Tue, 6 May 2014 04:41:14 +0000 (22:41 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 31 May 2014 17:52:32 +0000 (11:52 -0600)
This function is now more efficiently implemented as a synonym for
isUTF8_CHAR().  We retain the Perl_is_utf8_char_buf() function for code
that calls it that way.

embed.fnc
embed.h
proto.h
utf8.c
utf8.h

index 35756e4..30b1087 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -687,7 +687,7 @@ ADMpPR      |bool   |is_uni_punct_lc|UV c
 ADMpPR |bool   |is_uni_xdigit_lc|UV c
 Anpd   |bool   |is_ascii_string|NN const U8 *s|STRLEN len
 AnpdD  |STRLEN |is_utf8_char   |NN const U8 *s
-Anpd   |STRLEN |is_utf8_char_buf|NN const U8 *buf|NN const U8 *buf_end
+Abmnpd |STRLEN |is_utf8_char_buf|NN const U8 *buf|NN const U8 *buf_end
 Anpd   |bool   |is_utf8_string |NN const U8 *s|STRLEN len
 Anpdmb |bool   |is_utf8_string_loc|NN const U8 *s|STRLEN len|NULLOK const U8 **ep
 Anpd   |bool   |is_utf8_string_loclen|NN const U8 *s|STRLEN len|NULLOK const U8 **ep|NULLOK STRLEN *el
diff --git a/embed.h b/embed.h
index 5ad8ef6..4a3dbbd 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define is_utf8_ascii(a)       Perl_is_utf8_ascii(aTHX_ a)
 #define is_utf8_blank(a)       Perl_is_utf8_blank(aTHX_ a)
 #define is_utf8_char           Perl_is_utf8_char
-#define is_utf8_char_buf       Perl_is_utf8_char_buf
 #define is_utf8_cntrl(a)       Perl_is_utf8_cntrl(aTHX_ a)
 #define is_utf8_digit(a)       Perl_is_utf8_digit(aTHX_ a)
 #define is_utf8_graph(a)       Perl_is_utf8_graph(aTHX_ a)
diff --git a/proto.h b/proto.h
index d4a8589..e5b7478 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1992,9 +1992,9 @@ PERL_CALLCONV STRLEN      Perl_is_utf8_char(const U8 *s)
 #define PERL_ARGS_ASSERT_IS_UTF8_CHAR  \
        assert(s)
 
-PERL_CALLCONV STRLEN   Perl_is_utf8_char_buf(const U8 *buf, const U8 *buf_end)
+/* PERL_CALLCONV STRLEN        Perl_is_utf8_char_buf(const U8 *buf, const U8 *buf_end)
                        __attribute__nonnull__(1)
-                       __attribute__nonnull__(2);
+                       __attribute__nonnull__(2); */
 #define PERL_ARGS_ASSERT_IS_UTF8_CHAR_BUF      \
        assert(buf); assert(buf_end)
 
diff --git a/utf8.c b/utf8.c
index 8d62b5f..1b684f2 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -310,7 +310,7 @@ Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
 /*
 =for apidoc is_utf8_char_buf
 
-This is identical to the macro isUTF8_CHAR.
+This is identical to the macro L</isUTF8_CHAR>.
 
 =cut */
 
diff --git a/utf8.h b/utf8.h
index 924380d..74e7d48 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -649,6 +649,8 @@ machines) is a valid UTF-8 character.
                                    ? is_UTF8_CHAR_utf8_no_length_checks(s)  \
                                    : _is_utf8_char_slow(s, e))
 
+#define is_utf8_char_buf(buf, buf_end) isUTF8_CHAR(buf, buf_end)
+
 /* Do not use; should be deprecated.  Use isUTF8_CHAR() instead; this is
  * retained solely for backwards compatibility */
 #define IS_UTF8_CHAR(p, n)      (isUTF8_CHAR(p, (p) + (n)) == n)