summaryrefslogtreecommitdiff
path: root/charclass_invlists.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-07-06 12:26:43 -0600
committerKarl Williamson <public@khwilliamson.com>2013-07-16 13:58:06 -0600
commita0316a6cd4a14261beb22d95530d5763e8b6756b (patch)
tree26f2d40eaca022f4185e709ea341944aa3d9fef5 /charclass_invlists.h
parentd212d2222867b5b63a5f6d8c3243d0d45a26988c (diff)
downloadperl-a0316a6cd4a14261beb22d95530d5763e8b6756b.tar.gz
Reinstate + fix "Revert "regcomp.c: Add a constant 0 element before inversion lists" "
This reverts commit de353015643cf10b437d714d3483c1209e079916 which reverted 533c4e2f08b42d977e5004e823d4849f7473d2d0, thus reinstating it, plus this commit adds a fix to get it to pass under Address Sanitizer. The root cause of the problem is that there are two measures of the length of an inversion list. One is SvCUR(), and the other is invlist_len(). The original commit caused these to get off-by-one in some cases. The ultimate solution is to only store one value, and return the other one based off that. Rather than redo the whole branch, I've taken an easier way out, which is to add a dummy element at the end of some inversion lists, so that they aren't off-by-one. Then the other patches from the original branch will be applied. Each will be tested with Address Sanitizer. Then the work to fix the underlying problem will be done. The original commit's message was: This commit is the first step to separating the header from the body of inversion lists. Doing so will allow the compiled-in inversion lists to be fully read-only. To invert an inversion list, one simply unshifts a 0 to the front of it if one is not there, and shifts off the 0 if it does have one. The current data structure reserves an element at the beginning of each inversion list that is either 0 or 1. If 0, it means the inversion list begins there; if 1, it means the inversion list starts at the next element. Inverting involves flipping this bit. This commit changes the structure so that there is an additional element just after the element that flips. This new element is always 0, and the flipping element now says whether the inversion list begins at the constant 0 element, or the one after that. Doing this allows the flipping element to be separated in later commits from the body of the inversion list, which will always begin with the constant 0 element. That means that the body of the inversion list can be const.
Diffstat (limited to 'charclass_invlists.h')
-rw-r--r--charclass_invlists.h238
1 files changed, 136 insertions, 102 deletions
diff --git a/charclass_invlists.h b/charclass_invlists.h
index b5d71afb16..57fbe47af1 100644
--- a/charclass_invlists.h
+++ b/charclass_invlists.h
@@ -13,9 +13,10 @@ static UV Latin1_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 0, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 0, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
256,
0
};
@@ -28,9 +29,10 @@ static UV AboveLatin1_invlist[] = {
1, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
256
};
@@ -42,9 +44,10 @@ static UV ASCII_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 0, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 0, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
128,
0
};
@@ -57,9 +60,10 @@ static UV L1Cased_invlist[] = {
16, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
65,
91,
97,
@@ -86,9 +90,10 @@ static UV VertSpace_invlist[] = {
6, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
10,
14,
133,
@@ -105,9 +110,10 @@ static UV PerlSpace_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
14,
32,
@@ -122,9 +128,10 @@ static UV XPerlSpace_invlist[] = {
22, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
14,
32,
@@ -157,9 +164,10 @@ static UV PosixAlnum_invlist[] = {
6, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -176,9 +184,10 @@ static UV L1PosixAlnum_invlist[] = {
18, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -207,9 +216,10 @@ static UV PosixAlpha_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
65,
91,
97,
@@ -224,9 +234,10 @@ static UV L1PosixAlpha_invlist[] = {
16, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
65,
91,
97,
@@ -253,9 +264,10 @@ static UV PosixBlank_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
10,
32,
@@ -270,9 +282,10 @@ static UV XPosixBlank_invlist[] = {
18, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
10,
32,
@@ -301,9 +314,10 @@ static UV PosixCntrl_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 0, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 0, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
32,
127,
128,
@@ -318,9 +332,10 @@ static UV XPosixCntrl_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 0, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 0, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
32,
127,
160,
@@ -335,9 +350,10 @@ static UV PosixDigit_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58
};
@@ -350,9 +366,10 @@ static UV PosixGraph_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
33,
127
};
@@ -365,9 +382,10 @@ static UV L1PosixGraph_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
33,
127,
161,
@@ -382,9 +400,10 @@ static UV PosixLower_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
97,
123
};
@@ -397,9 +416,10 @@ static UV L1PosixLower_invlist[] = {
12, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
97,
123,
170,
@@ -422,9 +442,10 @@ static UV PosixPrint_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
32,
127
};
@@ -437,9 +458,10 @@ static UV L1PosixPrint_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
32,
127,
160,
@@ -454,9 +476,10 @@ static UV PosixPunct_invlist[] = {
8, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
33,
48,
58,
@@ -475,9 +498,10 @@ static UV L1PosixPunct_invlist[] = {
20, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
33,
48,
58,
@@ -508,9 +532,10 @@ static UV PosixSpace_invlist[] = {
4, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
14,
32,
@@ -525,9 +550,10 @@ static UV XPosixSpace_invlist[] = {
22, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
9,
14,
32,
@@ -560,9 +586,10 @@ static UV PosixUpper_invlist[] = {
2, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
65,
91
};
@@ -575,9 +602,10 @@ static UV L1PosixUpper_invlist[] = {
6, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
65,
91,
192,
@@ -594,9 +622,10 @@ static UV PosixWord_invlist[] = {
8, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -615,9 +644,10 @@ static UV L1PosixWord_invlist[] = {
20, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -648,9 +678,10 @@ static UV PosixXDigit_invlist[] = {
6, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -667,9 +698,10 @@ static UV XPosixXDigit_invlist[] = {
12, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
48,
58,
65,
@@ -690,9 +722,10 @@ static UV NonL1_Perl_Non_Final_Folds_invlist[] = {
44, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
700,
701,
776,
@@ -745,9 +778,10 @@ static UV _Perl_Multi_Char_Folds_invlist[] = {
58, /* Number of elements */
0, /* Current iteration position */
0, /* Cache of previous search index result */
- 290655244, /* Version and data structure type */
- 1, /* 0 if this is the first element of the list proper;
- 1 if the next element is the first */
+ 1039476070, /* Version and data structure type */
+ 1, /* 0 if the list starts at 0;
+ 1 if it starts at the element beyond 0 */
+ 0,
223,
224,
304,