This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Add some UNLIKELYs
authorKarl Williamson <khw@cpan.org>
Sun, 11 Sep 2016 04:18:59 +0000 (22:18 -0600)
committerKarl Williamson <khw@cpan.org>
Sun, 18 Sep 2016 03:10:49 +0000 (21:10 -0600)
utf8.c

diff --git a/utf8.c b/utf8.c
index 52b31dc..ec345ea 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -4140,7 +4140,7 @@ Perl_check_utf8_print(pTHX_ const U8* s, const STRLEN len)
        }
        if (UNLIKELY(isUTF8_POSSIBLY_PROBLEMATIC(*s))) {
            STRLEN char_len;
-           if (UTF8_IS_SUPER(s, e)) {
+           if (UNLIKELY(UTF8_IS_SUPER(s, e))) {
                 if (   ckWARN_d(WARN_NON_UNICODE)
                     || (   ckWARN_d(WARN_DEPRECATED)
 #ifndef UV_IS_QUAD
@@ -4163,7 +4163,7 @@ Perl_check_utf8_print(pTHX_ const U8* s, const STRLEN len)
                     ok = FALSE;
                 }
            }
-           else if (UTF8_IS_SURROGATE(s, e)) {
+           else if (UNLIKELY(UTF8_IS_SURROGATE(s, e))) {
                if (ckWARN_d(WARN_SURROGATE)) {
                     /* This has a different warning than the one the called
                      * function would output, so can't just call it, unlike we
@@ -4174,7 +4174,7 @@ Perl_check_utf8_print(pTHX_ const U8* s, const STRLEN len)
                    ok = FALSE;
                }
            }
-           else if ((UTF8_IS_NONCHAR(s, e)) && (ckWARN_d(WARN_NONCHAR))) {
+           else if (UNLIKELY(UTF8_IS_NONCHAR(s, e)) && (ckWARN_d(WARN_NONCHAR))) {
                 /* A side effect of this function will be to warn */
                 (void) utf8n_to_uvchr(s, e - s, &char_len, UTF8_WARN_NONCHAR);
                ok = FALSE;