This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Abolish RXf_UTF8. Store the UTF-8-ness of the pattern with SvUTF8().
[perl5.git] / regexp.h
index f76a8ea..8b5a7bb 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -100,9 +100,6 @@ typedef struct regexp {
         
         
         /* Information about the match that isn't often used */
-       /* wrapped can't be const char*, as it is returned by sv_2pv_flags */
-       char *wrapped;          /* wrapped version of the pattern */
-       I32 wraplen;            /* length of wrapped */
        unsigned pre_prefix:4;  /* offset from wrapped to the start of precomp */
        unsigned seen_evals:28; /* number of eval groups in the pattern - for security checks */ 
         HV *paren_names;       /* Optional hash of paren names */
@@ -305,7 +302,6 @@ and check for NULL.
 #define RXf_CHECK_ALL          0x00040000
 
 /* UTF8 related */
-#define RXf_UTF8               0x00080000
 #define RXf_MATCH_UTF8         0x00100000
 
 /* Intuit related */
@@ -358,18 +354,16 @@ and check for NULL.
                                         ? RX_MATCH_COPIED_on(prog) \
                                         : RX_MATCH_COPIED_off(prog))
 
-/* FIXME? Are we hardcoding too much here and constraining plugin extension
-   writers? Specifically, the value 1 assumes that the wrapped version always
-   has exactly one character at the end, a ')'. Will that always be true?  */
-#define RXp_PRELEN(rx)         ((rx)->wraplen - (rx)->pre_prefix - 1)
-#define RXp_WRAPLEN(rx)                ((rx)->wraplen)
 #define RXp_EXTFLAGS(rx)       ((rx)->extflags)
 
 /* For source compatibility. We used to store these explicitly.  */
-#define RX_PRECOMP(prog)       (((struct regexp *)SvANY(prog))->wrapped + ((struct regexp *)SvANY(prog))->pre_prefix)
-#define RX_PRELEN(prog)                RXp_PRELEN((struct regexp *)SvANY(prog))
-#define RX_WRAPPED(prog)       (((struct regexp *)SvANY(prog))->wrapped)
-#define RX_WRAPLEN(prog)       RXp_WRAPLEN((struct regexp *)SvANY(prog))
+#define RX_PRECOMP(prog)       (RX_WRAPPED(prog) + ((struct regexp *)SvANY(prog))->pre_prefix)
+/* FIXME? Are we hardcoding too much here and constraining plugin extension
+   writers? Specifically, the value 1 assumes that the wrapped version always
+   has exactly one character at the end, a ')'. Will that always be true?  */
+#define RX_PRELEN(prog)                (RX_WRAPLEN(prog) - ((struct regexp *)SvANY(prog))->pre_prefix - 1)
+#define RX_WRAPPED(prog)       SvPVX(prog)
+#define RX_WRAPLEN(prog)       SvCUR(prog)
 #define RX_CHECK_SUBSTR(prog)  (((struct regexp *)SvANY(prog))->check_substr)
 #define RX_EXTFLAGS(prog)      RXp_EXTFLAGS((struct regexp *)SvANY(prog))
 #define RX_REFCNT(prog)                SvREFCNT(prog)
@@ -417,7 +411,7 @@ and check for NULL.
                        : (RX_MATCH_UTF8_off(prog), (PL_reg_match_utf8 = 0)))
 
 /* Whether the pattern stored at RX_WRAPPED is in UTF-8  */
-#define RX_UTF8(prog)                  (RX_EXTFLAGS(prog) & RXf_UTF8)
+#define RX_UTF8(prog)                  SvUTF8(prog)
     
 #define REXEC_COPY_STR 0x01            /* Need to copy the string. */
 #define REXEC_CHECKED  0x02            /* check_substr already checked. */