Commit | Line | Data |
8565c31a |
1 | ################################################################################ |
2 | ## |
bfc37ff7 |
3 | ## $Revision: 2 $ |
8565c31a |
4 | ## $Author: mhx $ |
bfc37ff7 |
5 | ## $Date: 2010/03/07 13:15:44 +0100 $ |
8565c31a |
6 | ## |
7 | ################################################################################ |
8 | ## |
bfc37ff7 |
9 | ## Version 3.x, Copyright (C) 2004-2010, Marcus Holland-Moritz. |
8565c31a |
10 | ## Version 2.x, Copyright (C) 2001, Paul Marquess. |
11 | ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski. |
12 | ## |
13 | ## This program is free software; you can redistribute it and/or |
14 | ## modify it under the same terms as Perl itself. |
15 | ## |
16 | ################################################################################ |
17 | |
18 | =provides |
19 | |
20 | newSV_type |
21 | |
22 | =implementation |
23 | |
24 | #ifndef newSV_type |
25 | |
26 | #if { NEED newSV_type } |
27 | |
28 | SV* |
29 | newSV_type(pTHX_ svtype const t) |
30 | { |
31 | SV* const sv = newSV(0); |
32 | sv_upgrade(sv, t); |
33 | return sv; |
34 | } |
35 | |
36 | #endif |
37 | |
38 | #endif |
39 | |
40 | =xsinit |
41 | |
42 | #define NEED_newSV_type |
43 | |
44 | =xsubs |
45 | |
46 | int |
47 | newSV_type() |
48 | PREINIT: |
49 | SV* sv; |
50 | CODE: |
51 | RETVAL = 0; |
52 | sv = newSV_type(SVt_NULL); |
53 | if (SvTYPE(sv) == SVt_NULL) |
54 | { |
55 | RETVAL++; |
56 | } |
57 | SvREFCNT_dec(sv); |
58 | |
59 | sv = newSV_type(SVt_PVIV); |
60 | if (SvTYPE(sv) == SVt_PVIV) |
61 | { |
62 | RETVAL++; |
63 | } |
64 | SvREFCNT_dec(sv); |
65 | |
66 | sv = newSV_type(SVt_PVHV); |
67 | if (SvTYPE(sv) == SVt_PVHV) |
68 | { |
69 | RETVAL++; |
70 | } |
71 | SvREFCNT_dec(sv); |
72 | |
73 | sv = newSV_type(SVt_PVAV); |
74 | if (SvTYPE(sv) == SVt_PVAV) |
75 | { |
76 | RETVAL++; |
77 | } |
78 | SvREFCNT_dec(sv); |
79 | OUTPUT: |
80 | RETVAL |
81 | |
82 | |
83 | =tests plan => 1 |
84 | |
85 | ok(Devel::PPPort::newSV_type(), 4); |
86 | |