This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make Perl_regdupe only exist for threaded perls.
authorNicholas Clark <nick@ccl4.org>
Tue, 26 Sep 2006 22:29:09 +0000 (22:29 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 26 Sep 2006 22:29:09 +0000 (22:29 +0000)
p4raw-id: //depot/perl@28893

embed.fnc
embed.h
ext/re/re.xs
makedef.pl
proto.h
regcomp.c
thrdvar.h

index 5755f06..170023c 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -668,7 +668,9 @@ Ap  |I32    |pregexec       |NN regexp* prog|NN char* stringarg \
                                |NN char* strend|NN char* strbeg|I32 minend \
                                |NN SV* screamer|U32 nosave
 Ap     |void   |pregfree       |NULLOK struct regexp* r
+#if defined(USE_ITHREADS)
 Ap     |regexp*|regdupe        |NN const regexp* r|NN CLONE_PARAMS* param
+#endif
 Ap     |regexp*|pregcomp       |NN char* exp|NN char* xend|NN PMOP* pm
 Ap     |char*  |re_intuit_start|NN regexp* prog|NULLOK SV* sv|NN char* strpos \
                                |NN char* strend|U32 flags \
diff --git a/embed.h b/embed.h
index 0ec1775..69ab33b 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define regclass_swash         Perl_regclass_swash
 #define pregexec               Perl_pregexec
 #define pregfree               Perl_pregfree
+#if defined(USE_ITHREADS)
 #define regdupe                        Perl_regdupe
+#endif
 #define pregcomp               Perl_pregcomp
 #define re_intuit_start                Perl_re_intuit_start
 #define re_intuit_string       Perl_re_intuit_string
 #define regclass_swash(a,b,c,d,e)      Perl_regclass_swash(aTHX_ a,b,c,d,e)
 #define pregexec(a,b,c,d,e,f,g)        Perl_pregexec(aTHX_ a,b,c,d,e,f,g)
 #define pregfree(a)            Perl_pregfree(aTHX_ a)
+#if defined(USE_ITHREADS)
 #define regdupe(a,b)           Perl_regdupe(aTHX_ a,b)
+#endif
 #define pregcomp(a,b,c)                Perl_pregcomp(aTHX_ a,b,c)
 #define re_intuit_start(a,b,c,d,e,f)   Perl_re_intuit_start(aTHX_ a,b,c,d,e,f)
 #define re_intuit_string(a)    Perl_re_intuit_string(aTHX_ a)
index 7fad146..3433a0f 100644 (file)
@@ -36,14 +36,24 @@ struct regexp_engine {
                                    struct re_scream_pos_data_s *data);
     SV*                (*re_intuit_string) (pTHX_ regexp *prog);
     void       (*regfree) (pTHX_ struct regexp* r);
+#if defined(USE_ITHREADS)
     regexp*    (*regdupe) (pTHX_ regexp *r, CLONE_PARAMS *param);
+#endif
 };
 
 struct regexp_engine engines[] = {
     { Perl_pregcomp, Perl_regexec_flags, Perl_re_intuit_start,
-      Perl_re_intuit_string, Perl_pregfree, Perl_regdupe },
+      Perl_re_intuit_string, Perl_pregfree
+#if defined(USE_ITHREADS)
+       , Perl_regdupe
+#endif
+    },
     { my_regcomp, my_regexec, my_re_intuit_start, my_re_intuit_string,
-      my_regfree, my_regdupe }
+      my_regfree
+#if defined(USE_ITHREADS)
+      , my_regdupe
+#endif
+    }
 };
 
 #define MY_CXT_KEY "re::_guts" XS_VERSION
@@ -76,7 +86,9 @@ install(pTHX_ unsigned int new_state)
     PL_regint_start = engines[new_state].re_intuit_start;
     PL_regint_string = engines[new_state].re_intuit_string;
     PL_regfree = engines[new_state].regfree;
+#if defined(USE_ITHREADS)
     PL_regdupe = engines[new_state].regdupe;
+#endif
 
     if (new_state & NEEDS_DEBUGGING) {
        PL_colorset = 0;        /* Allow reinspection of ENV. */
index 57d6c75..6eebcab 100644 (file)
@@ -748,6 +748,7 @@ unless ($define{'USE_ITHREADS'}) {
                    Perl_sharedsv_thrcnt_inc
                    Perl_sharedsv_unlock
                    Perl_stashpv_hvname_match
+                   Perl_regdupe
                    )];
 }
 
diff --git a/proto.h b/proto.h
index 386f4ab..2f6045d 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1833,10 +1833,12 @@ PERL_CALLCONV I32       Perl_pregexec(pTHX_ regexp* prog, char* stringarg, char* stren
                        __attribute__nonnull__(pTHX_6);
 
 PERL_CALLCONV void     Perl_pregfree(pTHX_ struct regexp* r);
+#if defined(USE_ITHREADS)
 PERL_CALLCONV regexp*  Perl_regdupe(pTHX_ const regexp* r, CLONE_PARAMS* param)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 
+#endif
 PERL_CALLCONV regexp*  Perl_pregcomp(pTHX_ char* exp, char* xend, PMOP* pm)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
index a959bf6..62e0a91 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -7677,10 +7677,10 @@ Perl_pregfree(pTHX_ struct regexp *r)
    See pregfree() above if you change anything here. 
 */
        
+#if defined(USE_ITHREADS)
 regexp *
 Perl_regdupe(pTHX_ const regexp *r, CLONE_PARAMS *param)
 {
-#if defined(USE_ITHREADS)
     dVAR;
     REGEXP *ret;
     int i, len, npar;
@@ -7802,10 +7802,9 @@ Perl_regdupe(pTHX_ const regexp *r, CLONE_PARAMS *param)
 
     ptr_table_store(PL_ptr_table, r, ret);
     return ret;
-#else
     return NULL;    
-#endif    
 }
+#endif    
 
 #ifndef PERL_IN_XSUB_RE
 /*
index ead3278..d25db06 100644 (file)
--- a/thrdvar.h
+++ b/thrdvar.h
@@ -176,8 +176,10 @@ PERLVARI(Tregint_string,re_intuit_string_t, MEMBER_TO_FPTR(Perl_re_intuit_string
 PERLVARI(Tregfree,     regfree_t, MEMBER_TO_FPTR(Perl_pregfree))
                                        /* Pointer to REx free()er */
 
+#if defined(USE_ITHREADS)
 PERLVARI(Tregdupe,     regdupe_t, MEMBER_TO_FPTR(Perl_regdupe))
                                        /* Pointer to REx dupe()er */
+#endif
 
 
 PERLVARI(Treginterp_cnt,int,       0)  /* Whether "Regexp" was interpolated. */