summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2006-12-17 17:17:34 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-12-18 16:06:38 +0000
commit6a3d5e3dbfbb290a39e3787450653a41f07f3b5d (patch)
tree919cbe41888dfb8fb191c942adddf029b56ae7a7 /cop.h
parentc38a65302a7e2e2ea9b8748d368c87d573add6fd (diff)
downloadperl-6a3d5e3dbfbb290a39e3787450653a41f07f3b5d.tar.gz
Re: [PATCH] do not meddle in the affairs of PERL_TRACK_MEMPOOL
Message-ID: <4586084E.8040706@iki.fi> Introduce CopLABEL() macro to deal with labels attached to COPs. p4raw-id: //depot/perl@29585
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/cop.h b/cop.h
index d75d2f1194..722e135e4b 100644
--- a/cop.h
+++ b/cop.h
@@ -186,12 +186,20 @@ struct cop {
? gv_stashpv(CopSTASHPV(c),GV_ADD) : NULL)
# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME_get(hv) : NULL)
# define CopSTASH_eq(c,hv) ((hv) && stashpv_hvname_match(c,hv))
+# define CopLABEL(c) ((c)->cop_label)
+# ifdef NETWARE
+# define CopLABEL_set(c,pv) ((CopLABEL(c) = ((pv) ? savepv(pv) : NULL)), Safefree(pv), ((pv) = NULL))
+# else
+# define CopLABEL_set(c,pv) ((CopLABEL(c) = savesharedpv(pv)), Safefree(pv), ((pv) = NULL))
+# endif
# ifdef NETWARE
# define CopSTASH_free(c) SAVECOPSTASH_FREE(c)
# define CopFILE_free(c) SAVECOPFILE_FREE(c)
+# define CopLABEL_free(c) SAVECOPLABEL_FREE(c)
# else
# define CopSTASH_free(c) PerlMemShared_free(CopSTASHPV(c))
# define CopFILE_free(c) (PerlMemShared_free(CopFILE(c)),(CopFILE(c) = NULL))
+# define CopLABEL_free(c) (PerlMemShared_free(CopLABEL(c)),(CopLABEL(c) = NULL))
# endif
#else
# define CopFILEGV(c) ((c)->cop_filegv)
@@ -206,13 +214,16 @@ struct cop {
# endif
# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : NULL)
# define CopSTASH(c) ((c)->cop_stash)
+# define CopLABEL(c) ((c)->cop_label)
# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv))
# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME_get(CopSTASH(c)) : NULL)
/* cop_stash is not refcounted */
# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv))
+# define CopLABEL_set(c,pv) (CopLABEL(c) = (pv))
# define CopSTASH_free(c)
# define CopFILE_free(c) (SvREFCNT_dec(CopFILEGV(c)),(CopFILEGV(c) = NULL))
+# define CopLABEL_free(c)
#endif /* USE_ITHREADS */