diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-12 20:43:46 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-12 20:43:46 +0000 |
commit | 14a976d69a5d1d716c7c894452d30ab0c3386193 (patch) | |
tree | 6c500ff4f95fd0d681c55a834a9ec49bd1df49c0 | |
parent | eb042f38945910bd3c5b898e8ae84f9c92d93bdb (diff) | |
download | perl-14a976d69a5d1d716c7c894452d30ab0c3386193.tar.gz |
Small tweaks.
p4raw-id: //depot/perl@15208
-rw-r--r-- | lib/Internals.t | 9 | ||||
-rw-r--r-- | universal.c | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/Internals.t b/lib/Internals.t index 1f514fd344..e8abebbb2d 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 16000f723d..85a09161d2 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. */ } |