]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blob - Valgrind.xs
Also strip the (new) tail after cutting the suppression at Perl_runops
[perl/modules/Test-Valgrind.git] / Valgrind.xs
1 /* This file is part of the Scalar::Vec::Util Perl module.
2  * See http://search.cpan.org/dist/Scalar-Vec-Util/ */
3
4 #define PERL_NO_GET_CONTEXT
5 #include "EXTERN.h"
6 #include "perl.h"
7 #include "XSUB.h"
8
9 #define __PACKAGE__ "Test::Valgrind"
10
11 #ifndef Newx
12 # define Newx(v, n, c) New(0, v, n, c)
13 #endif
14
15 #ifndef DEBUGGING
16 # define DEBUGGING 0
17 #endif
18
19 const char *tv_leaky = NULL;
20
21 /* --- XS ------------------------------------------------------------------ */
22
23 MODULE = Test::Valgrind            PACKAGE = Test::Valgrind
24
25 PROTOTYPES: DISABLE
26
27 BOOT:
28 {
29  HV *stash = gv_stashpv(__PACKAGE__, 1);
30  newCONSTSUB(stash, "DEBUGGING", newSVuv(DEBUGGING));
31 }
32
33 void
34 leak()
35 CODE:
36  tv_leaky = malloc(10000);
37  XSRETURN_UNDEF;
38
39 SV *
40 notleak(SV *sv)
41 CODE:
42  Newx(tv_leaky, 10000, char);
43  Safefree(tv_leaky);
44  RETVAL = newSVsv(sv);
45 OUTPUT:
46  RETVAL