diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-11-19 14:22:00 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-01-13 09:58:32 -0700 |
commit | 7b95354822ec2e64dc2d911ea0d11d9dba7a1687 (patch) | |
tree | 3b7d8dff49c9e06e778ea78b38b006ad889f6742 /lib/utf8_heavy.pl | |
parent | e22ae573a312160a7c2faf86823c71cb9cbe7cbf (diff) | |
download | perl-7b95354822ec2e64dc2d911ea0d11d9dba7a1687.tar.gz |
utf8_heavy: Skip unnecessary operations
The mktables generated tables are well-formed, already sorted, and with
no extra items such as "+utf8::foo". Thus we don't have to do these
operations on them, but they are required on user-defined properties,
and should $list be passed in as a parameter.
This patch moves the code that does this to just the user-defined area
Diffstat (limited to 'lib/utf8_heavy.pl')
-rw-r--r-- | lib/utf8_heavy.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index 225a99e215..29b974ef74 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -101,6 +101,9 @@ sub _loose_name ($) { # Change this to get a different set of Unicode tables my $unicore_dir = 'unicore'; my $invert_it = 0; + my $list_is_from_mktables = 0; # Is $list returned from a mktables + # generated file? If so, we know it's + # well behaved. if ($type) { @@ -508,17 +511,21 @@ sub _loose_name ($) { local $@; local $!; $list = do $file; die $@ if $@; + $list_is_from_mktables = 1; } } # End of $type is non-null # Here, either $type was null, or we found the requested property and # read it into $list - my $extras; + my $extras = ""; my $bits = $minbits; - if ($list) { + # mktables lists don't have extras, like '&utf8::prop', so don't need + # to separate them; also lists are already sorted, so don't need to do + # that. + if ($list && ! $list_is_from_mktables) { my $taint = substr($list,0,0); # maintain taint # Separate the extras from the code point list, and for |