From: Vincent Pit Date: Thu, 15 Apr 2010 23:28:52 +0000 (+0200) Subject: {ENTER,LEAVE}_with_name are no longer needed starting perl 5.11.4 X-Git-Tag: v0.04~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=22959c257e28ede6726925b5098404585a8bac40;p=perl%2Fmodules%2FThread-Cleanup.git {ENTER,LEAVE}_with_name are no longer needed starting perl 5.11.4 --- diff --git a/Cleanup.xs b/Cleanup.xs index 948c38f..f41b2c8 100644 --- a/Cleanup.xs +++ b/Cleanup.xs @@ -9,12 +9,20 @@ #define __PACKAGE__ "Thread::Cleanup" #define __PACKAGE_LEN__ (sizeof(__PACKAGE__)-1) -#ifndef ENTER_with_name -# define ENTER_with_name(N) ENTER +#define TC_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S)))))) + +#undef ENTERn +#if defined(ENTER_with_name) && !TC_HAS_PERL(5, 11, 4) +# define ENTERn(N) ENTER_with_name(N) +#else +# define ENTERn(N) ENTER #endif -#ifndef LEAVE_with_name -# define LEAVE_with_name(N) LEAVE +#undef LEAVEn +#if defined(LEAVE_with_name) && !TC_HAS_PERL(5, 11, 4) +# define LEAVEn(N) LEAVE_with_name(N) +#else +# define LEAVEn(N) LEAVE #endif STATIC void tc_callback(pTHX_ void *); @@ -60,7 +68,7 @@ CODE: { level = PerlMemShared_malloc(sizeof *level); *level = 1; - LEAVE_with_name("sub"); + LEAVEn("sub"); SAVEDESTRUCTOR_X(tc_callback, level); - ENTER_with_name("sub"); + ENTERn("sub"); }