summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-05-29 09:16:49 -0600
committerKarl Williamson <public@khwilliamson.com>2011-07-03 14:05:46 -0600
commit61bdbf381e9d66f094a47eb25d5b0274d9f14036 (patch)
tree91fa51c8a1e6f05943700d689da8c1d019766740 /regcomp.c
parent0d527bf8bd304ed25714b0d4c06ca5d3123e9198 (diff)
downloadperl-61bdbf381e9d66f094a47eb25d5b0274d9f14036.tar.gz
Add length element to inversion lists
Future changes will make the length no longer the same as SvCUR, so create an element to hold the correct length
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index 7644485bad..8635a10b98 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -5835,7 +5835,8 @@ S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags)
* Some of the methods should always be private to the implementation, and some
* should eventually be made public */
-#define INVLIST_ITER_OFFSET 0
+#define INVLIST_LEN_OFFSET 0
+#define INVLIST_ITER_OFFSET 1
#define HEADER_LENGTH (INVLIST_ITER_OFFSET + 1)
/* Internally things are UVs */
@@ -5856,6 +5857,17 @@ S_invlist_array(pTHX_ SV* const invlist)
return (UV *) (SvPVX(invlist) + TO_INTERNAL_SIZE(0));
}
+PERL_STATIC_INLINE UV*
+S_get_invlist_len_addr(pTHX_ SV* invlist)
+{
+ /* Return the address of the UV that contains the current number
+ * of used elements in the inversion list */
+
+ PERL_ARGS_ASSERT_GET_INVLIST_LEN_ADDR;
+
+ return (UV *) (SvPVX(invlist) + (INVLIST_LEN_OFFSET * sizeof (UV)));
+}
+
PERL_STATIC_INLINE UV
S_invlist_len(pTHX_ SV* const invlist)
{
@@ -5863,7 +5875,7 @@ S_invlist_len(pTHX_ SV* const invlist)
PERL_ARGS_ASSERT_INVLIST_LEN;
- return FROM_INTERNAL_SIZE(SvCUR(invlist));
+ return *get_invlist_len_addr(invlist);
}
PERL_STATIC_INLINE UV
@@ -5885,6 +5897,7 @@ S_invlist_set_len(pTHX_ SV* const invlist, const UV len)
PERL_ARGS_ASSERT_INVLIST_SET_LEN;
SvCUR_set(invlist, TO_INTERNAL_SIZE(len));
+ *get_invlist_len_addr(invlist) = len;
}
#ifndef PERL_IN_XSUB_RE