Add a new CvISXSUB() macro, for abstracting the test as to whether a
authorNicholas Clark <nick@ccl4.org>
Mon, 20 Feb 2006 10:40:59 +0000 (10:40 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 Feb 2006 10:40:59 +0000 (10:40 +0000)
PVCV is perl or XS.

p4raw-id: //depot/perl@27241

cv.h
dump.c
ext/Devel/Peek/Peek.xs
gv.c
op.c
pad.c
pp_ctl.c
pp_hot.c
pp_sort.c
sv.c

diff --git a/cv.h b/cv.h
index 9f2594a19f0590439e46f02c553316c61b2bd3a0..7e60be7e1a923b9e228ea7135131989622cdedfe 100644 (file)
--- a/cv.h
+++ b/cv.h
@@ -153,7 +153,7 @@ Returns the stash of the CV.
 #define CvWEAKOUTSIDE_on(cv)   (CvFLAGS(cv) |= CVf_WEAKOUTSIDE)
 #define CvWEAKOUTSIDE_off(cv)  (CvFLAGS(cv) &= ~CVf_WEAKOUTSIDE)
 
-
+#define CvISXSUB(cv)           (CvXSUB(cv) ? TRUE : FALSE)
 /*
 =head1 CV reference counts and CvOUTSIDE
 
diff --git a/dump.c b/dump.c
index 6799c475416b01daa4f19092ef2529a168d3e2f7..02b1c22a2e79fe31feaeb6500506152bb1943734 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -89,7 +89,7 @@ Perl_dump_sub(pTHX_ const GV *gv)
 
     gv_fullname3(sv, gv, NULL);
     Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX_const(sv));
-    if (CvXSUB(GvCV(gv)))
+    if (CvISXSUB(GvCV(gv)))
        Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n",
            PTR2UV(CvXSUB(GvCV(gv))),
            (int)CvXSUBANY(GvCV(gv)).any_i32);
index 5bec844ccd2bee3278476d489b55c447cebe1a28..a88d23141ddfcc7f31ee695aa6964ef04365ada6 100644 (file)
@@ -39,7 +39,7 @@ DeadCode(pTHX)
                int levels, tots = 0, levela, tota = 0, levelas, totas = 0;
                int dumpit = 0;
 
-               if (CvXSUB(sv)) {
+               if (CvISXSUB(sv)) {
                    continue;           /* XSUB */
                }
                if (!CvGV(sv)) {
diff --git a/gv.c b/gv.c
index 555260f40b3f8ec10df26c809f66b454b238fc92..d866b6636e015776bf3a1970fc052c78403bb6fa 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -600,7 +600,7 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
          "Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
             packname, (int)len, name);
 
-    if (CvXSUB(cv)) {
+    if (CvISXSUB(cv)) {
         /* rather than lookup/init $AUTOLOAD here
          * only to have the XSUB do another lookup for $AUTOLOAD
          * and split that value on the last '::',
diff --git a/op.c b/op.c
index 2830834ae1b86781f180d42b5562d8230c1fdddd..cb507bac7777751a4a37cd7594a40a40bbd749f1 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4261,14 +4261,14 @@ Perl_cv_undef(pTHX_ CV *cv)
 {
     dVAR;
 #ifdef USE_ITHREADS
-    if (CvFILE(cv) && !CvXSUB(cv)) {
+    if (CvFILE(cv) && !CvISXSUB(cv)) {
        /* for XSUBs CvFILE point directly to static memory; __FILE__ */
        Safefree(CvFILE(cv));
     }
     CvFILE(cv) = 0;
 #endif
 
-    if (!CvXSUB(cv) && CvROOT(cv)) {
+    if (!CvISXSUB(cv) && CvROOT(cv)) {
        if (CvDEPTH(cv))
            Perl_croak(aTHX_ "Can't undef active subroutine");
        ENTER;
diff --git a/pad.c b/pad.c
index aa806ea95ae99d45ccda81897a175eefde5dc1d4..75f08389d005fc45d45840830467fcd9177cdaaf 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1445,8 +1445,8 @@ Perl_cv_clone(pTHX_ CV *proto)
     CvCLONED_on(cv);
 
 #ifdef USE_ITHREADS
-    CvFILE(cv)         = CvXSUB(proto) ? CvFILE(proto)
-                                       : savepv(CvFILE(proto));
+    CvFILE(cv)         = CvISXSUB(proto) ? CvFILE(proto)
+                                         : savepv(CvFILE(proto));
 #else
     CvFILE(cv)         = CvFILE(proto);
 #endif
index 725920f2967747aa2bd73dd135a643d776e0bec5..80113a49a8db43bd28a14857cb226c640cb58495 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1763,7 +1763,7 @@ PP(pp_dbstate)
        hasargs = 0;
        SPAGAIN;
 
-       if (CvXSUB(cv)) {
+       if (CvISXSUB(cv)) {
            CvDEPTH(cv)++;
            PUSHMARK(SP);
            (void)(*CvXSUB(cv))(aTHX_ cv);
@@ -2352,7 +2352,7 @@ PP(pp_goto)
                    PAD_SVl(0) = (SV*)(cx->blk_sub.argarray = av);
                }
            }
-           else if (CvXSUB(cv)) {      /* put GvAV(defgv) back onto stack */
+           else if (CvISXSUB(cv)) {    /* put GvAV(defgv) back onto stack */
                AV* const av = GvAV(PL_defgv);
                items = AvFILLp(av) + 1;
                EXTEND(SP, items+1); /* @_ could have been extended. */
@@ -2369,7 +2369,7 @@ PP(pp_goto)
            /* Now do some callish stuff. */
            SAVETMPS;
            SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
-           if (CvXSUB(cv)) {
+           if (CvISXSUB(cv)) {
                OP* retop = cx->blk_sub.retop;
                if (reified) {
                    I32 index;
index 677808f3f9595204ca9f12ec2568a1faa0c8f1d3..242b03c11c7c2fec567fc0fa8c757a6d09574818 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2667,7 +2667,7 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv)
        SvIV_set(dbsv, PTR2IV(cv));     /* Do it the quickest way  */
     }
 
-    if (CvXSUB(cv))
+    if (CvISXSUB(cv))
        PL_curcopdb = PL_curcop;
     cv = GvCV(PL_DBsub);
     return cv;
@@ -2785,7 +2785,7 @@ try_autoload:
            DIE(aTHX_ "No DB::sub routine defined");
     }
 
-    if (!(CvXSUB(cv))) {
+    if (!(CvISXSUB(cv))) {
        /* This path taken at least 75% of the time   */
        dMARK;
        register I32 items = SP - MARK;
index 48595886cbbfc6ed86484c1aa09c439b4d999abc..104e8ed90d2b718034b6fe22a20fbfb2342321f2 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1515,7 +1515,7 @@ PP(pp_sort)
                }
            }
            if (!(cv && CvROOT(cv))) {
-               if (cv && CvXSUB(cv)) {
+               if (cv && CvISXSUB(cv)) {
                    is_xsub = 1;
                }
                else if (gv) {
diff --git a/sv.c b/sv.c
index 30b84f088db1d2bdfe8049b567749b899371ba86..75ba8958368d450f6b58e82d7f0949a08e52754c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -9843,7 +9843,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
                    CvWEAKOUTSIDE(sstr)
                    ? cv_dup(    CvOUTSIDE(dstr), param)
                    : cv_dup_inc(CvOUTSIDE(dstr), param);
-               if (!CvXSUB(dstr))
+               if (!CvISXSUB(dstr))
                    CvFILE(dstr) = SAVEPV(CvFILE(dstr));
                break;
            }