S_forget_pmop() only needs a flags argument for the ithreads case,
authorNicholas Clark <nick@ccl4.org>
Tue, 10 Apr 2007 14:49:31 +0000 (14:49 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 10 Apr 2007 14:49:31 +0000 (14:49 +0000)
because PmopSTASH_free() is a no-op in an unthreaded perl.

p4raw-id: //depot/perl@30891

embed.fnc
embed.h
op.c
op.h
proto.h

index 7e2cc35..ba2616a 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1195,7 +1195,11 @@ pR       |OP*    |ck_trunc       |NN OP *o
 pR     |OP*    |ck_unpack      |NN OP *o
 sRn    |bool   |is_handle_constructor|NN const OP *o|I32 numargs
 sR     |I32    |is_list_assignment|NULLOK const OP *o
-s      |void   |forget_pmop    |NN PMOP *const o|U32 flags
+#  ifdef USE_ITHREADS
+so     |void   |forget_pmop    |NN PMOP *const o|U32 flags
+#  else
+so     |void   |forget_pmop    |NN PMOP *const o
+#  endif
 s      |void   |find_and_forget_pmops  |NN OP *o
 s      |void   |cop_free       |NN COP *cop
 s      |OP*    |modkids        |NULLOK OP *o|I32 type
diff --git a/embed.h b/embed.h
index 71ccb4d..e02e844 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define ck_unpack              Perl_ck_unpack
 #define is_handle_constructor  S_is_handle_constructor
 #define is_list_assignment     S_is_list_assignment
-#define forget_pmop            S_forget_pmop
+#endif
+#  ifdef USE_ITHREADS
+#  else
+#  endif
+#ifdef PERL_CORE
 #define find_and_forget_pmops  S_find_and_forget_pmops
 #define cop_free               S_cop_free
 #define modkids                        S_modkids
 #define ck_unpack(a)           Perl_ck_unpack(aTHX_ a)
 #define is_handle_constructor  S_is_handle_constructor
 #define is_list_assignment(a)  S_is_list_assignment(aTHX_ a)
-#define forget_pmop(a,b)       S_forget_pmop(aTHX_ a,b)
+#endif
+#  ifdef USE_ITHREADS
+#ifdef PERL_CORE
+#endif
+#  else
+#ifdef PERL_CORE
+#endif
+#  endif
+#ifdef PERL_CORE
 #define find_and_forget_pmops(a)       S_find_and_forget_pmops(aTHX_ a)
 #define cop_free(a)            S_cop_free(aTHX_ a)
 #define modkids(a,b)           S_modkids(aTHX_ a,b)
diff --git a/op.c b/op.c
index efe5611..e1b5ec5 100644 (file)
--- a/op.c
+++ b/op.c
@@ -407,6 +407,11 @@ S_op_destroy(pTHX_ OP *o)
     FreeOp(o);
 }
 
+#ifdef USE_ITHREADS
+#  define forget_pmop(a,b)     S_forget_pmop(aTHX_ a,b)
+#else
+#  define forget_pmop(a,b)     S_forget_pmop(aTHX_ a)
+#endif
 
 /* Destructor */
 
@@ -636,7 +641,11 @@ S_cop_free(pTHX_ COP* cop)
 }
 
 STATIC void
-S_forget_pmop(pTHX_ PMOP *const o, U32 flags)
+S_forget_pmop(pTHX_ PMOP *const o
+#ifdef USE_ITHREADS
+             , U32 flags
+#endif
+             )
 {
     HV * const pmstash = PmopSTASH(o);
     if (pmstash && !SvIS_FREED(pmstash)) {
@@ -665,8 +674,10 @@ S_forget_pmop(pTHX_ PMOP *const o, U32 flags)
     }
     if (PL_curpm == o) 
        PL_curpm = NULL;
+#ifdef USE_ITHREADS
     if (flags)
        PmopSTASH_free(o);
+#endif
 }
 
 STATIC void
diff --git a/op.h b/op.h
index 2631fa8..d9d5336 100644 (file)
--- a/op.h
+++ b/op.h
@@ -422,6 +422,8 @@ struct pmop {
 #  define PmopSTASHPV(o)       (PmopSTASH(o) ? HvNAME_get(PmopSTASH(o)) : NULL)
    /* op_pmstashstartu.op_pmstash is not refcounted */
 #  define PmopSTASHPV_set(o,pv)        PmopSTASH_set((o), gv_stashpv(pv,GV_ADD))
+/* Note that if this becomes non-empty, then S_forget_pmop in op.c will need
+   changing */
 #  define PmopSTASH_free(o)    
 #endif
 
diff --git a/proto.h b/proto.h
index 8bab32e..52dd8e7 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3240,9 +3240,15 @@ STATIC bool      S_is_handle_constructor(const OP *o, I32 numargs)
 STATIC I32     S_is_list_assignment(pTHX_ const OP *o)
                        __attribute__warn_unused_result__;
 
+#  ifdef USE_ITHREADS
 STATIC void    S_forget_pmop(pTHX_ PMOP *const o, U32 flags)
                        __attribute__nonnull__(pTHX_1);
 
+#  else
+STATIC void    S_forget_pmop(pTHX_ PMOP *const o)
+                       __attribute__nonnull__(pTHX_1);
+
+#  endif
 STATIC void    S_find_and_forget_pmops(pTHX_ OP *o)
                        __attribute__nonnull__(pTHX_1);