diff options
author | Brian Fraser <fraserbn@gmail.com> | 2011-07-05 01:27:13 -0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:00:57 -0700 |
commit | e606678100532d04b0a202d11e1d0f8323bd1564 (patch) | |
tree | c5c32020e67b933ab54436b773725c0e46f412f2 /ext/XS-APItest/APItest.xs | |
parent | 0eaf81c53c0965e619d33cdd6a5f53c2f4bed7cf (diff) | |
download | perl-e606678100532d04b0a202d11e1d0f8323bd1564.tar.gz |
gv.c: Added gv_init_(sv|pv|pvn), renamed gv_init_sv as gv_init_svtype.
gv_init_pvn() is the same as the old gv_init(), but takes
a flags parameter, which will be used for the UTF-8 cleanup.
The old gv_init() is now implemeneted as a macro in gv.h.
Also included is some minimal testing in XS::APItest.
Diffstat (limited to 'ext/XS-APItest/APItest.xs')
-rw-r--r-- | ext/XS-APItest/APItest.xs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 37f7a0e290..d555931c49 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -1840,6 +1840,35 @@ call_method(methname, flags, ...) PUSHs(sv_2mortal(newSViv(i))); void +gv_init_type(namesv, multi, flags, type) + SV* namesv + int multi + I32 flags + int type + PREINIT: + STRLEN len; + const char * const name = SvPV_const(namesv, len); + GV *gv = *(GV**)hv_fetch(PL_defstash, name, len, TRUE); + PPCODE: + if (SvTYPE(gv) == SVt_PVGV) + Perl_croak(aTHX_ "GV is already a PVGV"); + switch (type) { + case 0: + gv_init(gv, PL_defstash, name, len, multi); + break; + case 1: + gv_init_sv(gv, PL_defstash, namesv, multi, flags); + break; + case 2: + gv_init_pv(gv, PL_defstash, name, multi, flags | SvUTF8(namesv)); + break; + case 3: + gv_init_pvn(gv, PL_defstash, name, len, multi, flags | SvUTF8(namesv)); + break; + } + XPUSHs( gv ? (SV*)gv : &PL_sv_undef); + +void eval_sv(sv, flags) SV* sv I32 flags |