This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/uv: Comments only
[perl5.git] / dist / Devel-PPPort / parts / inc / newSV_type
CommitLineData
8565c31a
MHM
1################################################################################
2##
b2049988 3## Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
8565c31a
MHM
4## Version 2.x, Copyright (C) 2001, Paul Marquess.
5## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
6##
7## This program is free software; you can redistribute it and/or
8## modify it under the same terms as Perl itself.
9##
10################################################################################
11
12=provides
13
14newSV_type
15
16=implementation
17
18#ifndef newSV_type
19
20#if { NEED newSV_type }
21
22SV*
23newSV_type(pTHX_ svtype const t)
24{
25 SV* const sv = newSV(0);
26 sv_upgrade(sv, t);
27 return sv;
28}
29
30#endif
31
32#endif
33
34=xsinit
35
36#define NEED_newSV_type
37
38=xsubs
39
40int
41newSV_type()
b2049988
MHM
42 PREINIT:
43 SV* sv;
44 CODE:
45 RETVAL = 0;
46 sv = newSV_type(SVt_NULL);
47 if (SvTYPE(sv) == SVt_NULL)
48 {
49 RETVAL++;
50 }
51 SvREFCNT_dec(sv);
52
53 sv = newSV_type(SVt_PVIV);
54 if (SvTYPE(sv) == SVt_PVIV)
55 {
56 RETVAL++;
57 }
58 SvREFCNT_dec(sv);
59
60 sv = newSV_type(SVt_PVHV);
61 if (SvTYPE(sv) == SVt_PVHV)
62 {
63 RETVAL++;
64 }
65 SvREFCNT_dec(sv);
66
67 sv = newSV_type(SVt_PVAV);
68 if (SvTYPE(sv) == SVt_PVAV)
69 {
70 RETVAL++;
71 }
72 SvREFCNT_dec(sv);
73 OUTPUT:
74 RETVAL
8565c31a
MHM
75
76
77=tests plan => 1
78
79ok(Devel::PPPort::newSV_type(), 4);