Move Devel::PPPort from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / Devel-PPPort / parts / inc / newRV
CommitLineData
adfe19db 1################################################################################
2##
51d6c659 3## $Revision: 9 $
adfe19db 4## $Author: mhx $
51d6c659 5## $Date: 2009/01/18 14:10:55 +0100 $
adfe19db 6##
7################################################################################
8##
51d6c659 9## Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
adfe19db 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
20newRV_inc
21newRV_noinc
22
23=implementation
24
25__UNDEFINED__ newRV_inc(sv) newRV(sv) /* Replace */
26
27#ifndef newRV_noinc
28#if { NEED newRV_noinc }
29SV *
30newRV_noinc(SV *sv)
31{
32 SV *rv = (SV *)newRV(sv);
33 SvREFCNT_dec(sv);
34 return rv;
35}
36#endif
37#endif
38
39=xsinit
40
41#define NEED_newRV_noinc
42
43=xsubs
44
45U32
46newRV_inc_REFCNT()
47 PREINIT:
48 SV *sv, *rv;
49 CODE:
50 sv = newSViv(42);
51 rv = newRV_inc(sv);
52 SvREFCNT_dec(sv);
53 RETVAL = SvREFCNT(sv);
54 sv_2mortal(rv);
55 OUTPUT:
56 RETVAL
57
58U32
59newRV_noinc_REFCNT()
60 PREINIT:
61 SV *sv, *rv;
62 CODE:
63 sv = newSViv(42);
64 rv = newRV_noinc(sv);
65 RETVAL = SvREFCNT(sv);
66 sv_2mortal(rv);
67 OUTPUT:
68 RETVAL
69
70=tests plan => 2
71
72ok(&Devel::PPPort::newRV_inc_REFCNT, 1);
73ok(&Devel::PPPort::newRV_noinc_REFCNT, 1);
74