From: Vincent Pit Date: Wed, 1 Oct 2014 23:16:53 +0000 (+0200) Subject: Use REP_HAS_PERL() whenever possible X-Git-Tag: v0.10~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8ccbfd9e6c16df59e92309bd9c43f03a7500ebd6;p=perl%2Fmodules%2Fre-engine-Plugin.git Use REP_HAS_PERL() whenever possible --- diff --git a/Plugin.xs b/Plugin.xs index 5095c73..2b0fe04 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -310,10 +310,10 @@ STATIC const rep_hint_t *rep_hint(pTHX) { START_EXTERN_C EXTERN_C const regexp_engine engine_plugin; -#if PERL_VERSION <= 10 -EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV * const, const U32); -#else +#if REP_HAS_PERL(5, 11, 0) EXTERN_C REGEXP * Plugin_comp(pTHX_ SV * const, U32); +#else +EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV * const, const U32); #endif EXTERN_C I32 Plugin_exec(pTHX_ REGEXP * const, char *, char *, char *, I32, SV *, void *, U32); @@ -336,9 +336,7 @@ EXTERN_C SV * Plugin_package(pTHX_ REGEXP * const); #ifdef USE_ITHREADS EXTERN_C void * Plugin_dupe(pTHX_ REGEXP * const, CLONE_PARAMS *); #endif -END_EXTERN_C -START_EXTERN_C EXTERN_C const regexp_engine engine_plugin; END_EXTERN_C @@ -384,7 +382,7 @@ typedef struct replug { SV * cb_num_capture_buff_LENGTH; } *re__engine__Plugin; -#if PERL_VERSION >= 11 +#if REP_HAS_PERL(5, 11, 0) # define rxREGEXP(RX) (SvANY(RX)) # define newREGEXP(RX) ((RX) = ((REGEXP*) newSV_type(SVt_REGEXP))) #else @@ -393,10 +391,10 @@ typedef struct replug { #endif REGEXP * -#if PERL_VERSION <= 10 -Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) -#else +#if REP_HAS_PERL(5, 11, 0) Plugin_comp(pTHX_ SV * const pattern, U32 flags) +#else +Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) #endif { dSP; @@ -432,7 +430,7 @@ Plugin_comp(pTHX_ SV * const pattern, U32 flags) rx->extflags = flags; /* Flags for perl to use */ rx->engine = RE_ENGINE_PLUGIN; /* Compile to use this engine */ -#if PERL_VERSION <= 10 +#if !REP_HAS_PERL(5, 11, 0) rx->refcnt = 1; /* Refcount so we won't be destroyed */ /* Precompiled pattern for pp_regcomp to use */