################################################################################ ## ## 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 defined(PERL_USE_GCC_BRACE_GROUPS) # define newSV_type(t) ({ SV *_sv = newSV(0); sv_upgrade(_sv, (t)); _sv; }) #else # define newSV_type(t) ((PL_Sv = newSV(0)), sv_upgrade(PL_Sv, (t)), PL_Sv) #endif #endif =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 is(Devel::PPPort::newSV_type(), 4);