This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Remove common code
authorKarl Williamson <khw@cpan.org>
Tue, 24 Jul 2018 23:25:13 +0000 (17:25 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 3 Aug 2018 18:55:11 +0000 (12:55 -0600)
Call another function that incorporates the same code that is removed by
this commit.

utf8.c

diff --git a/utf8.c b/utf8.c
index 3062f58..9308264 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -3117,24 +3117,7 @@ S_is_utf8_common(pTHX_ const U8 *const p, SV **swash,
         NOT_REACHED; /* NOTREACHED */
     }
 
-    if (invlist) {
-        return _invlist_contains_cp(invlist, valid_utf8_to_uvchr(p, NULL));
-    }
-
-    assert(swash);
-
-    if (!*swash) {
-        U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST;
-        *swash = _core_swash_init("utf8",
-
-                                  /* Only use the name if there is no inversion
-                                   * list; otherwise will go out to disk */
-                                  (invlist) ? "" : swashname,
-
-                                  &PL_sv_undef, 1, 0, invlist, &flags);
-    }
-
-    return swash_fetch(*swash, p, TRUE) != 0;
+    return is_utf8_common_with_len(p, p + len, swash, swashname, invlist);
 }
 
 PERL_STATIC_INLINE bool