Change 25409 wasn't necessary for threaded perls
Rafael Garcia-Suarez [Wed, 14 Sep 2005 08:11:08 +0000 (08:11 +0000)]
p4raw-id: //depot/perl@25411

toke.c

diff --git a/toke.c b/toke.c
index 760f978..b761777 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -664,13 +664,14 @@ S_incline(pTHX_ char *s)
     ch = *t;
     *t = '\0';
     if (t - s > 0) {
+#ifndef USE_ITHREADS
        const char *cf = CopFILE(PL_curcop);
        if (cf && strlen(cf) > 7 && strnEQ(cf, "(eval ", 6)) {
            /* must copy *{"::_<(eval N)[oldfilename:L]"}
             * to *{"::_<newfilename"} */
            char smallbuf[256], smallbuf2[256];
            char *tmpbuf, *tmpbuf2;
-           GV *gv, *gv2;
+           GV **gvp, *gv2;
            STRLEN tmplen = strlen(cf);
            STRLEN tmplen2 = strlen(s);
            if (tmplen + 3 < sizeof smallbuf)
@@ -686,17 +687,20 @@ S_incline(pTHX_ char *s)
            memcpy(tmpbuf + 2, cf, ++tmplen);
            memcpy(tmpbuf2 + 2, s, ++tmplen2);
            ++tmplen; ++tmplen2;
-           gv = *(GV**)hv_fetch(PL_defstash, tmpbuf, tmplen, FALSE);
-           gv2 = *(GV**)hv_fetch(PL_defstash, tmpbuf2, tmplen2, TRUE);
-           if (!isGV(gv2))
-               gv_init(gv2, PL_defstash, tmpbuf2, tmplen2, FALSE);
-           /* adjust ${"::_<newfilename"} to store the new file name */
-           GvSV(gv2) = newSVpvn(tmpbuf2 + 2, tmplen2 - 2);
-           GvHV(gv2) = (HV*)SvREFCNT_inc(GvHV(gv));
-           GvAV(gv2) = (AV*)SvREFCNT_inc(GvAV(gv));
+           gvp = (GV**)hv_fetch(PL_defstash, tmpbuf, tmplen, FALSE);
+           if (gvp) {
+               gv2 = *(GV**)hv_fetch(PL_defstash, tmpbuf2, tmplen2, TRUE);
+               if (!isGV(gv2))
+                   gv_init(gv2, PL_defstash, tmpbuf2, tmplen2, FALSE);
+               /* adjust ${"::_<newfilename"} to store the new file name */
+               GvSV(gv2) = newSVpvn(tmpbuf2 + 2, tmplen2 - 2);
+               GvHV(gv2) = (HV*)SvREFCNT_inc(GvHV(*gvp));
+               GvAV(gv2) = (AV*)SvREFCNT_inc(GvAV(*gvp));
+           }
            if (tmpbuf != smallbuf) Safefree(tmpbuf);
            if (tmpbuf2 != smallbuf2) Safefree(tmpbuf2);
        }
+#endif
        CopFILE_free(PL_curcop);
        CopFILE_set(PL_curcop, s);
     }