################################################################################ ## ## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz. ## Version 2.x, Copyright (C) 2001, Paul Marquess. ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski. ## ## This program is free software; you can redistribute it and/or ## modify it under the same terms as Perl itself. ## ################################################################################ =provides newSV_type =implementation #ifndef newSV_type #if { NEED newSV_type } SV* newSV_type(pTHX_ svtype const t) { SV* const sv = newSV(0); sv_upgrade(sv, t); return sv; } #endif #endif =xsinit #define NEED_newSV_type =xsubs int newSV_type() PREINIT: SV* sv; CODE: RETVAL = 0; sv = newSV_type(SVt_NULL); if (SvTYPE(sv) == SVt_NULL) { RETVAL++; } SvREFCNT_dec(sv); sv = newSV_type(SVt_PVIV); if (SvTYPE(sv) == SVt_PVIV) { RETVAL++; } SvREFCNT_dec(sv); sv = newSV_type(SVt_PVHV); if (SvTYPE(sv) == SVt_PVHV) { RETVAL++; } SvREFCNT_dec(sv); sv = newSV_type(SVt_PVAV); if (SvTYPE(sv) == SVt_PVAV) { RETVAL++; } SvREFCNT_dec(sv); OUTPUT: RETVAL =tests plan => 1 ok(Devel::PPPort::newSV_type(), 4);