Skip processing a file if the file to be opened is '-'
[p5sagit/p5-mst-13.2.git] / cop.h
diff --git a/cop.h b/cop.h
index 89fab94..88627d6 100644 (file)
--- a/cop.h
+++ b/cop.h
 struct cop {
     BASEOP
     char *     cop_label;      /* label for this construct */
-    HV *       cop_stash;      /* package line was compiled in */
 #ifdef USE_ITHREADS
+    char *     cop_stashpv;    /* package line was compiled in */
     char *     cop_file;       /* file name the following line # is from */
 #else
+    HV *       cop_stash;      /* package line was compiled in */
     GV *       cop_filegv;     /* file the following line # is from */
 #endif
     U32                cop_seq;        /* parse sequence number */
@@ -33,11 +34,15 @@ struct cop {
                                 ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
 #  define CopFILEAV(c)         (CopFILE(c) \
                                 ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
-#  define CopSTASH(c)          (CopSTASHPV(c) \
-                                ? gv_fetchstash(CopSTASHPV(c)) : Nullhv)
-#  define CopSTASH_set(c,hv)   ((c)->cop_stashpv = HvNAME(hv)) /* XXX */
-#  define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = pv)
 #  define CopSTASHPV(c)                ((c)->cop_stashpv)
+#  define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = savepv(pv)) /* XXX */
+#  define CopSTASH(c)          (CopSTASHPV(c) \
+                                ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
+#  define CopSTASH_set(c,hv)   CopSTASHPV_set(c, HvNAME(hv))
+#  define CopSTASH_eq(c,hv)    (hv                                     \
+                                && (CopSTASHPV(c) == HvNAME(hv)        \
+                                    || (CopSTASHPV(c) && HvNAME(hv)    \
+                                        && strEQ(CopSTASHPV(c), HvNAME(hv)))))
 #else
 #  define CopFILEGV(c)         ((c)->cop_filegv)
 #  define CopFILEGV_set(c,gv)  ((c)->cop_filegv = gv)
@@ -48,8 +53,11 @@ struct cop {
 #  define CopSTASH(c)          ((c)->cop_stash)
 #  define CopSTASH_set(c,hv)   ((c)->cop_stash = hv)
 #  define CopSTASHPV(c)                (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
+#  define CopSTASHPV_set(c,pv) CopSTASH_set(c, gv_stashpv(pv,GV_ADD))
+#  define CopSTASH_eq(c,hv)    (CopSTASH(c) == hv)
 #endif /* USE_ITHREADS */
 
+#define CopSTASH_ne(c,hv)      (!CopSTASH_eq(c,hv))
 #define CopLINE(c)             ((c)->cop_line)
 #define CopLINE_inc(c)         (++CopLINE(c))
 #define CopLINE_dec(c)         (--CopLINE(c))
@@ -362,7 +370,7 @@ struct stackinfo {
     I32                        si_type;        /* type of runlevel */
     struct stackinfo * si_prev;
     struct stackinfo * si_next;
-    I32 *              si_markbase;    /* where markstack begins for us.
+    I32                        si_markoff;     /* offset where markstack begins for us.
                                         * currently used only with DEBUGGING,
                                         * but not #ifdef-ed for bincompat */
 };
@@ -374,9 +382,10 @@ typedef struct stackinfo PERL_SI;
 #define cxstack_max    (PL_curstackinfo->si_cxmax)
 
 #ifdef DEBUGGING
-#  define      SET_MARKBASE PL_curstackinfo->si_markbase = PL_markstack_ptr
+#  define      SET_MARK_OFFSET \
+    PL_curstackinfo->si_markoff = PL_markstack_ptr - PL_markstack
 #else
-#  define      SET_MARKBASE NOOP
+#  define      SET_MARK_OFFSET NOOP
 #endif
 
 #define PUSHSTACKi(type) \
@@ -392,7 +401,7 @@ typedef struct stackinfo PERL_SI;
        AvFILLp(next->si_stack) = 0;                                    \
        SWITCHSTACK(PL_curstack,next->si_stack);                        \
        PL_curstackinfo = next;                                         \
-       SET_MARKBASE;                                                   \
+       SET_MARK_OFFSET;                                                \
     } STMT_END
 
 #define PUSHSTACK PUSHSTACKi(PERLSI_UNKNOWN)