X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Valgrind.xs;h=137ddf0b77616777f8e7e4b9322148ed22840f7b;hb=b34179155630f5f4cbea1749af4054a746ded9a4;hp=d50485687c63664ffe54b449f9dbf9441c115443;hpb=8d66aa098b18f8c9724b12bf446d330905122c57;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/Valgrind.xs b/Valgrind.xs index d504856..137ddf0 100644 --- a/Valgrind.xs +++ b/Valgrind.xs @@ -1,5 +1,5 @@ -/* This file is part of the Scalar::Vec::Util Perl module. - * See http://search.cpan.org/dist/Scalar-Vec-Util/ */ +/* This file is part of the Test::Valgrind Perl module. + * See http://search.cpan.org/dist/Test::Valgrind/ */ #define PERL_NO_GET_CONTEXT #include "EXTERN.h" @@ -16,7 +16,25 @@ # define DEBUGGING 0 #endif -const char *tvtxs_leaky = NULL; +const char *tv_leaky = NULL; + +/* malloc() on Windows needs the current interpreter. */ + +#ifdef PERL_IMPLICIT_SYS +# define TV_LEAK_PROTO pTHX +# define TV_LEAK_ARG aTHX +#else +# define TV_LEAK_PROTO void +# define TV_LEAK_ARG +#endif + +extern void tv_leak(TV_LEAK_PROTO); + +extern void tv_leak(TV_LEAK_PROTO) { + tv_leaky = malloc(10000); + + return; +} /* --- XS ------------------------------------------------------------------ */ @@ -33,14 +51,14 @@ BOOT: void leak() CODE: - Newx(tvtxs_leaky, 10000, char); + tv_leak(TV_LEAK_ARG); XSRETURN_UNDEF; SV * notleak(SV *sv) CODE: - Newx(tvtxs_leaky, 10000, char); - Safefree(tvtxs_leaky); + Newx(tv_leaky, 10000, char); + Safefree(tv_leaky); RETVAL = newSVsv(sv); OUTPUT: RETVAL