diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-15 02:41:58 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-05-15 02:41:58 +0000 |
commit | 55d729e4e15089064cd25ed6dce2c105389f3837 (patch) | |
tree | 051c5ca4ce1910143237cc92caf129a28ce98436 /gv.c | |
parent | 6ff81951f79dec32e15a779d288c1047f0e4fefb (diff) | |
download | perl-55d729e4e15089064cd25ed6dce2c105389f3837.tar.gz |
[win32] merge changes#922,944,949,965,970 from maintbranch
p4raw-link: @970 on //depot/maint-5.004/perl: 5362f8886d6c3fb908c863d910b1a158479419e2
p4raw-link: @965 on //depot/maint-5.004/perl: 8472ac73d6d802946d766b5459d2d9c334889a3f
p4raw-link: @949 on //depot/maint-5.004/perl: 4b161ae29769b4a3eb304314bbbfe5969417c8ec
p4raw-link: @944 on //depot/maint-5.004/perl: fa366f5fbba3f21113f9677105663454a3e0b678
p4raw-link: @922 on //depot/maint-5.004/perl: 68daf0ababdc0e913335a90c4361b792b2715301
p4raw-id: //depot/win32/perl@978
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 44 |
1 files changed, 38 insertions, 6 deletions
@@ -86,10 +86,18 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) { dTHR; register GP *gp; + bool doproto = SvTYPE(gv) > SVt_NULL; + char *proto = (doproto && SvPOK(gv)) ? SvPVX(gv) : NULL; sv_upgrade((SV*)gv, SVt_PVGV); - if (SvLEN(gv)) - Safefree(SvPVX(gv)); + if (SvLEN(gv)) { + if (proto) { + SvPVX(gv) = NULL; + SvLEN(gv) = 0; + SvPOK_off(gv); + } else + Safefree(SvPVX(gv)); + } Newz(602, gp, 1, GP); GvGP(gv) = gp_ref(gp); GvSV(gv) = NEWSV(72,0); @@ -102,6 +110,27 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) GvNAMELEN(gv) = len; if (multi) GvMULTI_on(gv); + if (doproto) { /* Replicate part of newSUB here. */ + ENTER; + start_subparse(0,0); /* Create CV in compcv. */ + GvCV(gv) = compcv; + LEAVE; + + GvCVGEN(gv) = 0; + sub_generation++; + CvGV(GvCV(gv)) = (GV*)SvREFCNT_inc(gv); + CvFILEGV(GvCV(gv)) = curcop->cop_filegv; + CvSTASH(GvCV(gv)) = curstash; +#ifdef USE_THREADS + CvOWNER(GvCV(gv)) = 0; + New(666, CvMUTEXP(GvCV(gv)), 1, perl_mutex); + MUTEX_INIT(CvMUTEXP(GvCV(gv))); +#endif /* USE_THREADS */ + if (proto) { + sv_setpv((SV*)GvCV(gv), proto); + Safefree(proto); + } + } } static void @@ -565,13 +594,15 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) gv_init_sv(gv, sv_type); } return gv; + } else if (add & GV_NOINIT) { + return gv; } /* Adding a new symbol */ - if (add & 4) + if (add & GV_ADDWARN) warn("Had to create %s unexpectedly", nambeg); - gv_init(gv, stash, name, len, add & 2); + gv_init(gv, stash, name, len, add & GV_ADDMULTI); gv_init_sv(gv, sv_type); GvFLAGS(gv) |= add_gvflags; @@ -598,7 +629,8 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) GvMULTI_on(gv); sv_magic((SV*)av, (SV*)gv, 'I', Nullch, 0); /* NOTE: No support for tied ISA */ - if (add & 2 && strEQ(nambeg,"AnyDBM_File::ISA") && AvFILLp(av) == -1) + if ((add & GV_ADDMULTI) && strEQ(nambeg,"AnyDBM_File::ISA") + && AvFILLp(av) == -1) { char *pname; av_push(av, newSVpv(pname = "NDBM_File",0)); @@ -830,7 +862,7 @@ gv_check(HV *stash) } else if (isALPHA(*HeKEY(entry))) { gv = (GV*)HeVAL(entry); - if (GvMULTI(gv)) + if (SvTYPE(gv) != SVt_PVGV || GvMULTI(gv)) continue; curcop->cop_line = GvLINE(gv); filegv = GvFILEGV(gv); |