X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=universal.c;h=868fe5514000c79ced23ce46d6121a0c1ad793f5;hb=1ed8eac0dfbbdc6acb022ff1733a2473c102328b;hp=a2a3e4d781b9f51bb01552be3eb5eb6bc03a907c;hpb=acfe0abcedaf592fb4b9cb69ce3468308ae99d91;p=p5sagit%2Fp5-mst-13.2.git diff --git a/universal.c b/universal.c index a2a3e4d..868fe55 100644 --- a/universal.c +++ b/universal.c @@ -142,6 +142,7 @@ XS(XS_utf8_upgrade); XS(XS_utf8_downgrade); XS(XS_utf8_unicode_to_native); XS(XS_utf8_native_to_unicode); +XS(XS_access_readonly); void Perl_boot_core_UNIVERSAL(pTHX) @@ -158,6 +159,7 @@ Perl_boot_core_UNIVERSAL(pTHX) newXS("utf8::downgrade", XS_utf8_downgrade, file); newXS("utf8::native_to_unicode", XS_utf8_native_to_unicode, file); newXS("utf8::unicode_to_native", XS_utf8_unicode_to_native, file); + newXSproto("access::readonly",XS_access_readonly, file, "\\[$%@];$"); } @@ -425,4 +427,22 @@ XS(XS_utf8_unicode_to_native) XSRETURN(1); } +XS(XS_access_readonly) +{ + dXSARGS; + SV *sv = SvRV(ST(0)); + IV old = SvREADONLY(sv); + if (items == 2) { + if (SvTRUE(ST(1))) { + SvREADONLY_on(sv); + } + else { + SvREADONLY_off(sv); + } + } + if (old) + XSRETURN_YES; + else + XSRETURN_NO; +}