summaryrefslogtreecommitdiff
path: root/dist/Devel-PPPort/parts/inc/newSV_type
blob: 039f8010bb552fcd5d588da593be2a171fe0df57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
################################################################################
##
##  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);