X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xsutils.c;h=86620083af78be8f6479afbafc0589827bdeb338;hb=ca0c25f67f45e5dccb746852d8545d7ae29ed067;hp=c37c12bf498ba6185277263b93462be3b3e658b2;hpb=88d019551b04ba7828be67e8c0f62de7f769b5d5;p=p5sagit%2Fp5-mst-13.2.git diff --git a/xsutils.c b/xsutils.c index c37c12b..8662008 100644 --- a/xsutils.c +++ b/xsutils.c @@ -57,14 +57,14 @@ static int modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) { SV *attr; - char *name; - STRLEN len; - bool negated; int nret; for (nret = 0 ; numattrs && (attr = *attrlist++); numattrs--) { - name = SvPV(attr, len); - if ((negated = (*name == '-'))) { + STRLEN len; + const char *name = SvPV_const(attr, len); + const bool negated = (*name == '-'); + + if (negated) { name++; len--; } @@ -132,10 +132,11 @@ modify_SV_attributes(pTHX_ SV *sv, SV **retlist, SV **attrlist, int numattrs) case 'e': if (memEQ(name, "uniqu", 5)) { if (SvTYPE(sv) == SVt_PVGV) { - if (negated) + if (negated) { GvUNIQUE_off(sv); - else + } else { GvUNIQUE_on(sv); + } } /* Hope this came from toke.c if not a GV. */ continue; @@ -258,7 +259,7 @@ usage: sv = SvRV(rv); if (SvOBJECT(sv)) - sv_setpv(TARG, HvNAME(SvSTASH(sv))); + sv_setpvn(TARG, HvNAME_get(SvSTASH(sv)), HvNAMELEN_get(SvSTASH(sv))); #if 0 /* this was probably a bad idea */ else if (SvPADMY(sv)) sv_setsv(TARG, &PL_sv_no); /* unblessed lexical */ @@ -284,7 +285,7 @@ usage: break; } if (stash) - sv_setpv(TARG, HvNAME(stash)); + sv_setpvn(TARG, HvNAME_get(stash), HvNAMELEN_get(stash)); } SvSETMAGIC(TARG); @@ -305,8 +306,7 @@ usage: rv = ST(0); ST(0) = TARG; - if (SvGMAGICAL(rv)) - mg_get(rv); + SvGETMAGIC(rv); if (!(SvOK(rv) && SvROK(rv))) goto usage; sv = SvRV(rv); @@ -331,3 +331,12 @@ XS(XS_attributes__warn_reserved) XSRETURN(1); } +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * ex: set ts=8 sts=4 sw=4 noet: + */