summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-22 09:31:16 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-22 09:31:16 +0000
commit54df26348193c7b5acc024fd6db17e462578f17c (patch)
tree039b0e3774e2183c1b2cd3fd51eddec8f5018a73
parent2980942b2f5909e829b4838431ea4ccc49645a4b (diff)
downloadperl-54df26348193c7b5acc024fd6db17e462578f17c.tar.gz
"Don't Repeat Yourself" on the "We *really* need to overwrite these
symbols" section. Minor tweaks to make it possible to use the code unchanged with 5.8.x p4raw-id: //depot/perl@27938
-rw-r--r--MANIFEST2
-rw-r--r--ext/re/re_comp.h7
-rw-r--r--ext/re/re_top.h29
-rw-r--r--regcomp.c29
-rw-r--r--regexec.c31
5 files changed, 58 insertions, 40 deletions
diff --git a/MANIFEST b/MANIFEST
index f8ab4118f2..2bfdfb6652 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -985,6 +985,8 @@ ext/POSIX/t/waitpid.t See if waitpid works
ext/POSIX/typemap POSIX extension interface types
ext/re/hints/mpeix.pl Hints for re for named architecture
ext/re/Makefile.PL re extension makefile writer
+ext/re/re_top.h re extension symbol hiding header
+ext/re/re_comp.h re extension wrapper for regcomp.h
ext/re/re.pm re extension Perl module
ext/re/re.xs re extension external subroutines
ext/re/t/re.t see if re pragma works
diff --git a/ext/re/re_comp.h b/ext/re/re_comp.h
new file mode 100644
index 0000000000..ba3aae851e
--- /dev/null
+++ b/ext/re/re_comp.h
@@ -0,0 +1,7 @@
+/* For blead, this file needs to do nothing other than pull in the regular
+ regcomp.h. For the 5.8.x re module it has to do more.
+ But doing it this way keeps regcomp.c and regexec.c clean.
+*/
+
+#include "regcomp.h"
+
diff --git a/ext/re/re_top.h b/ext/re/re_top.h
new file mode 100644
index 0000000000..59646721da
--- /dev/null
+++ b/ext/re/re_top.h
@@ -0,0 +1,29 @@
+/* need to replace pregcomp et al, so enable that */
+#ifndef PERL_IN_XSUB_RE
+# define PERL_IN_XSUB_RE
+#endif
+/* need access to debugger hooks */
+#if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING)
+# define DEBUGGING
+#endif
+
+/* We *really* need to overwrite these symbols: */
+#define Perl_regexec_flags my_regexec
+#define Perl_regdump my_regdump
+#define Perl_regprop my_regprop
+#define Perl_re_intuit_start my_re_intuit_start
+#define Perl_pregcomp my_regcomp
+#define Perl_pregfree my_regfree
+#define Perl_re_intuit_string my_re_intuit_string
+
+#define PERL_NO_GET_CONTEXT
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */
diff --git a/regcomp.c b/regcomp.c
index 8fb49d07e5..b504760be3 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -30,26 +30,7 @@
*/
#ifdef PERL_EXT_RE_BUILD
-/* need to replace pregcomp et al, so enable that */
-# ifndef PERL_IN_XSUB_RE
-# define PERL_IN_XSUB_RE
-# endif
-/* need access to debugger hooks */
-# if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING)
-# define DEBUGGING
-# endif
-#endif
-
-#ifdef PERL_IN_XSUB_RE
-/* We *really* need to overwrite these symbols: */
-# define Perl_pregcomp my_regcomp
-# define Perl_regdump my_regdump
-# define Perl_regprop my_regprop
-# define Perl_pregfree my_regfree
-# define Perl_re_intuit_string my_re_intuit_string
-/* *These* symbols are masked to allow static link. */
-
-# define PERL_NO_GET_CONTEXT
+#include "re_top.h"
#endif
/*
@@ -95,7 +76,11 @@
#endif
#define REG_COMP_C
-#include "regcomp.h"
+#ifdef PERL_IN_XSUB_RE
+# include "re_comp.h"
+#else
+# include "regcomp.h"
+#endif
#ifdef op
#undef op
@@ -3322,8 +3307,10 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp)
FAIL("Eval-group not allowed at runtime, use re 'eval'");
if (PL_tainting && PL_tainted)
FAIL("Eval-group in insecure regular expression");
+#if PERL_VERSION > 8
if (IN_PERL_COMPILETIME)
PL_cv_has_eval = 1;
+#endif
}
nextchar(pRExC_state);
diff --git a/regexec.c b/regexec.c
index b5f16c5962..747b61be3b 100644
--- a/regexec.c
+++ b/regexec.c
@@ -31,24 +31,7 @@
*/
#ifdef PERL_EXT_RE_BUILD
-/* need to replace pregcomp et al, so enable that */
-# ifndef PERL_IN_XSUB_RE
-# define PERL_IN_XSUB_RE
-# endif
-/* need access to debugger hooks */
-# if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING)
-# define DEBUGGING
-# endif
-#endif
-
-#ifdef PERL_IN_XSUB_RE
-/* We *really* need to overwrite these symbols: */
-# define Perl_regexec_flags my_regexec
-# define Perl_regdump my_regdump
-# define Perl_regprop my_regprop
-# define Perl_re_intuit_start my_re_intuit_start
-
-# define PERL_NO_GET_CONTEXT
+#include "re_top.h"
#endif
/*
@@ -87,7 +70,11 @@
#define PERL_IN_REGEXEC_C
#include "perl.h"
-#include "regcomp.h"
+#ifdef PERL_IN_XSUB_RE
+# include "re_comp.h"
+#else
+# include "regcomp.h"
+#endif
#define RF_tainted 1 /* tainted information used? */
#define RF_warned 2 /* warned about big count? */
@@ -2306,6 +2293,9 @@ typedef union re_unwind_t {
STATIC regmatch_state *
S_push_slab(pTHX)
{
+#if PERL_VERSION < 9
+ dMY_CXT;
+#endif
regmatch_slab *s = PL_regmatch_slab->next;
if (!s) {
Newx(s, 1, regmatch_slab);
@@ -2473,6 +2463,9 @@ S_push_slab(pTHX)
STATIC I32 /* 0 failure, 1 success */
S_regmatch(pTHX_ const regmatch_info *reginfo, regnode *prog)
{
+#if PERL_VERSION < 9
+ dMY_CXT;
+#endif
dVAR;
register const bool do_utf8 = PL_reg_match_utf8;
const U32 uniflags = UTF8_ALLOW_DEFAULT;