This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8_to_bytes(): Avoid work if possible
authorKarl Williamson <khw@cpan.org>
Tue, 6 Jun 2017 01:21:41 +0000 (19:21 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 8 Jun 2017 17:04:43 +0000 (11:04 -0600)
commit9fe0d3c275dfa1f5ca6d543f1dbbc34b8f7a16b1
treed230b7d062473bc36c2531ced014464416fb9e32
parent28de57be1a3d5f5f97657c55e127e33e4082ba4d
utf8_to_bytes(): Avoid work if possible

This converts to use the new function is_utf8_invariant_string_loc() to
find the first variant in the input.  If none are found, the function is
a no-op.  If the intial part of the input is all invariants, they are
now skipped during conversion, resulting in less work for such input.

The new function could also be optimized to speed up searching.
utf8.c