From: Abhijit Menon-Sen Date: Wed, 27 Jun 2001 03:51:27 +0000 (+0530) Subject: Re: [PATH] shared -> unique; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fb3795116dd07b7f236652a03ac53946b1af7cf;p=p5sagit%2Fp5-mst-13.2.git Re: [PATH] shared -> unique; Message-ID: <20010627035127.A17623@lustre.lustre.dyn.wiw.org> p4raw-id: //depot/perl@11089 --- diff --git a/dump.c b/dump.c index 2a8fec6..f23ac7b 100644 --- a/dump.c +++ b/dump.c @@ -960,7 +960,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo case SVt_PVGV: if (GvINTRO(sv)) sv_catpv(d, "INTRO,"); if (GvMULTI(sv)) sv_catpv(d, "MULTI,"); - if (GvSHARED(sv)) sv_catpv(d, "SHARED,"); + if (GvUNIQUE(sv)) sv_catpv(d, "UNIQUE,"); if (GvASSUMECV(sv)) sv_catpv(d, "ASSUMECV,"); if (GvIN_PAD(sv)) sv_catpv(d, "IN_PAD,"); if (flags & SVpad_OUR) sv_catpv(d, "OUR,"); diff --git a/gv.c b/gv.c index 1851f8b..e4951a0 100644 --- a/gv.c +++ b/gv.c @@ -46,9 +46,9 @@ Perl_gv_IOadd(pTHX_ register GV *gv) if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) Perl_croak(aTHX_ "Bad symbol for filehandle"); if (!GvIOp(gv)) { -#ifdef GV_SHARED_CHECK - if (GvSHARED(gv)) { - Perl_croak(aTHX_ "Bad symbol for filehandle (GV is shared)"); +#ifdef GV_UNIQUE_CHECK + if (GvUNIQUE(gv)) { + Perl_croak(aTHX_ "Bad symbol for filehandle (GV is unique)"); } #endif GvIOp(gv) = newIO(); diff --git a/gv.h b/gv.h index 01764e3..428ab77 100644 --- a/gv.h +++ b/gv.h @@ -133,15 +133,15 @@ HV *GvHVn(); /* XXX: all GvFLAGS options are used, borrowing GvGPFLAGS for the moment */ -#define GVf_SHARED 0x0001 -#define GvSHARED(gv) (GvGP(gv) && (GvGPFLAGS(gv) & GVf_SHARED)) -#define GvSHARED_on(gv) (GvGPFLAGS(gv) |= GVf_SHARED) -#define GvSHARED_off(gv) (GvGPFLAGS(gv) &= ~GVf_SHARED) +#define GVf_UNIQUE 0x0001 +#define GvUNIQUE(gv) (GvGP(gv) && (GvGPFLAGS(gv) & GVf_UNIQUE)) +#define GvUNIQUE_on(gv) (GvGPFLAGS(gv) |= GVf_UNIQUE) +#define GvUNIQUE_off(gv) (GvGPFLAGS(gv) &= ~GVf_UNIQUE) #ifdef USE_ITHREADS -#define GV_SHARED_CHECK +#define GV_UNIQUE_CHECK #else -#undef GV_SHARED_CHECK +#undef GV_UNIQUE_CHECK #endif #define Nullgv Null(GV*) diff --git a/op.c b/op.c index b15f9bc..2e6a13d 100644 --- a/op.c +++ b/op.c @@ -4598,9 +4598,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) cv = (!name || GvCVGEN(gv)) ? Nullcv : GvCV(gv); -#ifdef GV_SHARED_CHECK - if (cv && GvSHARED(gv) && SvREADONLY(cv)) { - Perl_croak(aTHX_ "Can't define subroutine %s (GV is shared)", name); +#ifdef GV_UNIQUE_CHECK + if (cv && GvUNIQUE(gv) && SvREADONLY(cv)) { + Perl_croak(aTHX_ "Can't define subroutine %s (GV is unique)", name); } #endif @@ -4612,9 +4612,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) if (cv) { bool exists = CvROOT(cv) || CvXSUB(cv); -#ifdef GV_SHARED_CHECK - if (exists && GvSHARED(gv)) { - Perl_croak(aTHX_ "Can't redefine shared subroutine %s", name); +#ifdef GV_UNIQUE_CHECK + if (exists && GvUNIQUE(gv)) { + Perl_croak(aTHX_ "Can't redefine unique subroutine %s", name); } #endif @@ -5102,9 +5102,9 @@ Perl_newFORM(pTHX_ I32 floor, OP *o, OP *block) else name = "STDOUT"; gv = gv_fetchpv(name,TRUE, SVt_PVFM); -#ifdef GV_SHARED_CHECK - if (GvSHARED(gv)) { - Perl_croak(aTHX_ "Bad symbol for form (GV is shared)"); +#ifdef GV_UNIQUE_CHECK + if (GvUNIQUE(gv)) { + Perl_croak(aTHX_ "Bad symbol for form (GV is unique)"); } #endif GvMULTI_on(gv); diff --git a/pp_sys.c b/pp_sys.c index 83dfb19..29bc12a 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -758,9 +758,9 @@ PP(pp_tie) methname = "TIEARRAY"; break; case SVt_PVGV: -#ifdef GV_SHARED_CHECK - if (GvSHARED((GV*)varsv)) { - Perl_croak(aTHX_ "Attempt to tie shared GV"); +#ifdef GV_UNIQUE_CHECK + if (GvUNIQUE((GV*)varsv)) { + Perl_croak(aTHX_ "Attempt to tie unique GV"); } #endif methname = "TIEHANDLE"; diff --git a/sv.c b/sv.c index 630603f..d14810c 100644 --- a/sv.c +++ b/sv.c @@ -3613,8 +3613,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) Perl_croak(aTHX_ "Can't redefine active sort subroutine %s", GvNAME(dstr)); -#ifdef GV_SHARED_CHECK - if (GvSHARED((GV*)dstr)) { +#ifdef GV_UNIQUE_CHECK + if (GvUNIQUE((GV*)dstr)) { Perl_croak(aTHX_ PL_no_modify); } #endif @@ -3659,8 +3659,8 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags) SV *dref = 0; int intro = GvINTRO(dstr); -#ifdef GV_SHARED_CHECK - if (GvSHARED((GV*)dstr)) { +#ifdef GV_UNIQUE_CHECK + if (GvUNIQUE((GV*)dstr)) { Perl_croak(aTHX_ PL_no_modify); } #endif @@ -8636,7 +8636,7 @@ S_gv_share(pTHX_ SV *sstr) SV *sv = &PL_sv_no; /* just need SvREADONLY-ness */ if (GvIO(gv) || GvFORM(gv)) { - GvSHARED_off(gv); /* GvIOs cannot be shared. nor can GvFORMs */ + GvUNIQUE_off(gv); /* GvIOs cannot be shared. nor can GvFORMs */ } else if (!GvCV(gv)) { GvCV(gv) = (CV*)sv; @@ -8644,11 +8644,11 @@ S_gv_share(pTHX_ SV *sstr) else { /* CvPADLISTs cannot be shared */ if (!CvXSUB(GvCV(gv))) { - GvSHARED_off(gv); + GvUNIQUE_off(gv); } } - if (!GvSHARED(gv)) { + if (!GvUNIQUE(gv)) { #if 0 PerlIO_printf(Perl_debug_log, "gv_share: unable to share %s::%s\n", HvNAME(GvSTASH(gv)), GvNAME(gv)); @@ -8832,7 +8832,7 @@ Perl_sv_dup(pTHX_ SV *sstr, clone_params* param) LvTYPE(dstr) = LvTYPE(sstr); break; case SVt_PVGV: - if (GvSHARED((GV*)sstr)) { + if (GvUNIQUE((GV*)sstr)) { SV *share; if ((share = gv_share(sstr))) { del_SV(dstr); diff --git a/toke.c b/toke.c index 55f656a..751253e 100644 --- a/toke.c +++ b/toke.c @@ -3092,7 +3092,7 @@ Perl_yylex(pTHX) CvMETHOD_on(PL_compcv); #ifdef USE_ITHREADS else if (PL_in_my == KEY_our && len == 6 && strnEQ(s, "unique", len)) - GvSHARED_on(cGVOPx_gv(yylval.opval)); + GvUNIQUE_on(cGVOPx_gv(yylval.opval)); #endif /* After we've set the flags, it could be argued that we don't need to do the attributes.pm-based setting diff --git a/xsutils.c b/xsutils.c index fd43e23..382befb 100644 --- a/xsutils.c +++ b/xsutils.c @@ -87,9 +87,9 @@ modify_SV_attributes(pTHXo_ SV *sv, SV **retlist, SV **attrlist, int numattrs) case 's': if (strEQ(name, "unique")) { if (negated) - GvSHARED_off(CvGV((CV*)sv)); + GvUNIQUE_off(CvGV((CV*)sv)); else - GvSHARED_on(CvGV((CV*)sv)); + GvUNIQUE_on(CvGV((CV*)sv)); continue; } break; @@ -103,7 +103,7 @@ modify_SV_attributes(pTHXo_ SV *sv, SV **retlist, SV **attrlist, int numattrs) switch (*name) { case 's': if (strEQ(name, "unique")) { - /* toke.c has already marked as GvSHARED */ + /* toke.c has already marked as GVf_UNIQUE */ continue; } } @@ -189,7 +189,7 @@ usage: #endif if (cvflags & CVf_METHOD) XPUSHs(sv_2mortal(newSVpvn("method", 6))); - if (GvSHARED(CvGV((CV*)sv))) + if (GvUNIQUE(CvGV((CV*)sv))) XPUSHs(sv_2mortal(newSVpvn("unique", 6))); break; default: