From: Jarkko Hietaniemi Date: Tue, 12 Mar 2002 20:43:46 +0000 (+0000) Subject: Small tweaks. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14a976d69a5d1d716c7c894452d30ab0c3386193;p=p5sagit%2Fp5-mst-13.2.git Small tweaks. p4raw-id: //depot/perl@15208 --- diff --git a/lib/Internals.t b/lib/Internals.t index 1f514fd..e8abebb 100644 --- a/lib/Internals.t +++ b/lib/Internals.t @@ -7,9 +7,11 @@ BEGIN { } } -use Test::More tests => 29; +use Test::More tests => 33; my $foo; +my @foo; +my %foo; ok( !Internals::SvREADONLY $foo ); ok( Internals::SvREADONLY $foo, 1 ); @@ -49,3 +51,8 @@ is( Internals::SvREFCNT($foo), 1 ); } is( Internals::SvREFCNT($foo), 1 ); +is( Internals::SvREFCNT(@foo), 1 ); +is( Internals::SvREFCNT($foo[2]), 1 ); +is( Internals::SvREFCNT(%foo), 1 ); +is( Internals::SvREFCNT($foo{foo}), 1 ); + diff --git a/universal.c b/universal.c index 16000f7..85a0916 100644 --- a/universal.c +++ b/universal.c @@ -462,7 +462,7 @@ XS(XS_utf8_unicode_to_native) XSRETURN(1); } -XS(XS_Internals_SvREADONLY) +XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */ { dXSARGS; SV *sv = SvRV(ST(0)); @@ -478,23 +478,25 @@ XS(XS_Internals_SvREADONLY) XSRETURN_YES; } else { + /* I hope you really know what you are doing. */ SvREADONLY_off(sv); XSRETURN_NO; } } - XSRETURN_UNDEF; + XSRETURN_UNDEF; /* Can't happen. */ } -XS(XS_Internals_SvREFCNT) +XS(XS_Internals_SvREFCNT) /* This is dangerous stuff. */ { dXSARGS; SV *sv = SvRV(ST(0)); if (items == 1) - XSRETURN_IV(SvREFCNT(sv) - 1); /* minus the SvRV above */ + XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */ else if (items == 2) { + /* I hope you really know what you are doing. */ SvREFCNT(sv) = SvIV(ST(1)); XSRETURN_IV(SvREFCNT(sv)); } - XSRETURN_UNDEF; + XSRETURN_UNDEF; /* Can't happen. */ }