summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-07-04 22:01:05 -0600
committerKarl Williamson <public@khwilliamson.com>2013-07-04 22:44:52 -0600
commitde353015643cf10b437d714d3483c1209e079916 (patch)
treebf756d015c7d5c70451fc1f071c0c79ef3977565 /regen
parentac7a6f5849b5fd57b2e837f4ddbc18c992610e9c (diff)
downloadperl-de353015643cf10b437d714d3483c1209e079916.tar.gz
Revert "regcomp.c: Add a constant 0 element before inversion lists"
This reverts commit 533c4e2f08b42d977e5004e823d4849f7473d2d0. This continues the backing out of this topic branch. A bisect shows that the first commit exhibiting an error is the first one in the branch.
Diffstat (limited to 'regen')
-rw-r--r--regen/mk_invlists.pl27
1 files changed, 18 insertions, 9 deletions
diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl
index 27c080233c..67b6e417fc 100644
--- a/regen/mk_invlists.pl
+++ b/regen/mk_invlists.pl
@@ -15,7 +15,7 @@ require 'regen/regen_lib.pl';
# in the headers is used to minimize the possibility of things getting
# out-of-sync, or the wrong data structure being passed. Currently that
# random number is:
-my $VERSION_DATA_STRUCTURE_TYPE = 1039476070;
+my $VERSION_DATA_STRUCTURE_TYPE = 290655244;
my $out_fh = open_new('charclass_invlists.h', '>',
{style => '*', by => $0,
@@ -36,18 +36,27 @@ sub output_invlist ($$) {
# Output the inversion list $invlist using the name $name for it.
# It is output in the exact internal form for inversion lists.
- # Is the last element of the header 0, or 1 ?
- my $zero_or_one = 0;
- my $count = @$invlist;
- if ($invlist->[0] != 0) {
- unshift @$invlist, 0;
+ my $zero_or_one; # Is the last element of the header 0, or 1 ?
+
+ # If the first element is 0, it goes in the header, instead of the body
+ if ($invlist->[0] == 0) {
+ shift @$invlist;
+
+ $zero_or_one = 0;
+
+ # Add a dummy 0 at the end so that the length is constant. inversion
+ # lists are always stored with enough room so that if they change from
+ # beginning with 0, they don't have to grow.
+ push @$invlist, 0;
+ }
+ else {
$zero_or_one = 1;
}
print $out_fh "\n#ifndef PERL_IN_XSUB_RE\n" unless exists $include_in_ext_re{$name};
print $out_fh "\nstatic UV ${name}_invlist[] = {\n";
- print $out_fh "\t$count,\t/* Number of elements */\n";
+ print $out_fh "\t", scalar @$invlist, ",\t/* Number of elements */\n";
# This should be UV_MAX, but I (khw) am not confident that the suffixes
# for specifying the constant are portable, e.g. 'ull' on a 32 bit
@@ -56,8 +65,8 @@ sub output_invlist ($$) {
print $out_fh "\t0,\t/* Cache of previous search index result */\n";
print $out_fh "\t$VERSION_DATA_STRUCTURE_TYPE, /* Version and data structure type */\n";
print $out_fh "\t", $zero_or_one,
- ",\t/* 0 if the list starts at 0;",
- "\n\t\t 1 if it starts at the element beyond 0 */\n";
+ ",\t/* 0 if this is the first element of the list proper;",
+ "\n\t\t 1 if the next element is the first */\n";
# The main body are the UVs passed in to this routine. Do the final
# element separately