? 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)
# 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 */
STATIC void
S_cop_free(pTHX_ COP* cop)
{
- if (cop->cop_label) {
-#ifdef PERL_TRACK_MEMPOOL
- Malloc_t ptr = (Malloc_t)(cop->cop_label - sTHX);
- struct perl_memory_debug_header *const header
- = (struct perl_memory_debug_header *)ptr;
- /* Only the thread that allocated us can free us. */
- if (header->interpreter == aTHX)
-#endif
- {
- Safefree(cop->cop_label);
- cop->cop_label = NULL;
- }
- }
+ CopLABEL_free(cop);
CopFILE_free(cop);
CopSTASH_free(cop);
if (! specialWARN(cop->cop_warnings))
cop->op_next = (OP*)cop;
if (label) {
- cop->cop_label = label;
+ CopLABEL_set(cop, label);
PL_hints |= HINT_BLOCK_SCOPE;
}
cop->cop_seq = seq;
# define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c))
# define SAVECOPFILE(c) SAVEPPTR(CopFILE(c))
# define SAVECOPFILE_FREE(c) SAVESHAREDPV(CopFILE(c))
+# define SAVECOPLABEL(c) SAVEPPTR(CopLABEL(c))
+# define SAVECOPLABEL_FREE(c) SAVESHAREDPV(CopLABEL(c))
#else
# define SAVECOPSTASH(c) SAVESPTR(CopSTASH(c))
# define SAVECOPSTASH_FREE(c) SAVECOPSTASH(c) /* XXX not refcounted */
# define SAVECOPFILE(c) SAVESPTR(CopFILEGV(c))
# define SAVECOPFILE_FREE(c) SAVEGENERICSV(CopFILEGV(c))
+# define SAVECOPLABEL(c) SAVEPPTR(CopLABEL(c))
+# define SAVECOPLABEL_FREE(c) SAVEPPTR(CopLABEL(c))
#endif
#define SAVECOPLINE(c) SAVEI32(CopLINE(c))