summaryrefslogtreecommitdiff
path: root/inline_invlist.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-07-04 18:57:55 -0600
committerKarl Williamson <public@khwilliamson.com>2013-07-04 19:06:35 -0600
commit247f9b19318882fd9a52fe49aa31fc8d3d3db4f7 (patch)
treee08f9be590b087022f9417a0be29cd2adf2e3f76 /inline_invlist.c
parent49cf1d6641a6dfd301302f616e4f25595dcc65d4 (diff)
downloadperl-247f9b19318882fd9a52fe49aa31fc8d3d3db4f7.tar.gz
Revert "regcomp.c: Move some #defines to only file that uses them"
This reverts commit 05944450e0fc82eb8fc1fb5a4bf63f23785262a0. Blead won't compile with address sanitizer; commit 7cb47964955167736b2923b008cc8023a9b035e8 reverting an earlier commit failed to fix that. I'm trying two more reversions to get it back working. This is one of those
Diffstat (limited to 'inline_invlist.c')
-rw-r--r--inline_invlist.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/inline_invlist.c b/inline_invlist.c
index ced42d85c0..c6bc47ef38 100644
--- a/inline_invlist.c
+++ b/inline_invlist.c
@@ -8,6 +8,30 @@
#if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C)
+#define INVLIST_LEN_OFFSET 0 /* Number of elements in the inversion list */
+
+/* This is a combination of a version and data structure type, so that one
+ * being passed in can be validated to be an inversion list of the correct
+ * vintage. When the structure of the header is changed, a new random number
+ * in the range 2**31-1 should be generated. Then, if an auxiliary program
+ * doesn't change correspondingly, it will be discovered immediately */
+#define INVLIST_VERSION_ID_OFFSET 1
+#define INVLIST_VERSION_ID 1826693541
+
+#define INVLIST_OFFSET_OFFSET 2 /* 0 or 1 */
+/* The UV at this position contains either 0 or 1. If 0, the inversion list
+ * contains the code point U+00000, and begins at element [0] in the array,
+ * which always contains 0. If 1, the inversion list doesn't contain U+0000,
+ * and it begins at element [1]. Inverting an inversion list consists of
+ * adding or removing the 0 at the beginning of it. By reserving a space for
+ * that 0, inversion can be made very fast: we just flip this UV */
+
+/* For safety, when adding new elements, remember to #undef them at the end of
+ * the inversion list code section */
+
+#define HEADER_LENGTH (INVLIST_OFFSET_OFFSET + 1) /* includes 1 for the constant
+ 0 element */
+
/* An element is in an inversion list iff its index is even numbered: 0, 2, 4,
* etc */
#define ELEMENT_RANGE_MATCHES_INVLIST(i) (! ((i) & 1))