From: Nicholas Clark Date: Wed, 26 Nov 2008 22:25:18 +0000 (+0000) Subject: rxres_free() and rxres_restore() are only used in pp_ctl.c, so can be X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c105995f0120a86f489fa9da8e150fc55635f02;p=p5sagit%2Fp5-mst-13.2.git rxres_free() and rxres_restore() are only used in pp_ctl.c, so can be static. Macros PUSHSUBST() and POPSUBST() are only viable in PERL_CORE. p4raw-id: //depot/perl@34935 --- diff --git a/cop.h b/cop.h index dae356d..39a6b01 100644 --- a/cop.h +++ b/cop.h @@ -610,7 +610,8 @@ struct subst { #define sb_rxres cx_u.cx_subst.sbu_rxres #define sb_rx cx_u.cx_subst.sbu_rx -#define PUSHSUBST(cx) CXINC, cx = &cxstack[cxstack_ix], \ +#ifdef PERL_CORE +# define PUSHSUBST(cx) CXINC, cx = &cxstack[cxstack_ix], \ cx->sb_iters = iters, \ cx->sb_maxiters = maxiters, \ cx->sb_rflags = r_flags, \ @@ -628,11 +629,12 @@ struct subst { rxres_save(&cx->sb_rxres, rx); \ (void)ReREFCNT_inc(rx) -#define CxONCE(cx) ((cx)->cx_type & CXp_ONCE) - -#define POPSUBST(cx) cx = &cxstack[cxstack_ix--]; \ +# define POPSUBST(cx) cx = &cxstack[cxstack_ix--]; \ rxres_free(&cx->sb_rxres); \ ReREFCNT_dec(cx->sb_rx) +#endif + +#define CxONCE(cx) ((cx)->cx_type & CXp_ONCE) struct context { union { diff --git a/embed.fnc b/embed.fnc index e0b84c2..1b3fde0 100644 --- a/embed.fnc +++ b/embed.fnc @@ -772,8 +772,11 @@ Ap |Sighandler_t|rsignal |int i|Sighandler_t t p |int |rsignal_restore|int i|NULLOK Sigsave_t* t p |int |rsignal_save |int i|Sighandler_t t1|NN Sigsave_t* save Ap |Sighandler_t|rsignal_state|int i -p |void |rxres_free |NN void** rsp -p |void |rxres_restore |NN void **rsp|NN REGEXP *rx +#if defined(PERL_IN_PP_CTL_C) +s |void |rxres_free |NN void** rsp +s |void |rxres_restore |NN void **rsp|NN REGEXP *rx +#endif +: Used in pp_hot.c p |void |rxres_save |NN void **rsp|NN REGEXP *rx #if !defined(HAS_RENAME) p |I32 |same_dirent |NN const char* a|NN const char* b diff --git a/embed.h b/embed.h index b5911b6..1884770 100644 --- a/embed.h +++ b/embed.h @@ -758,9 +758,13 @@ #define rsignal_save Perl_rsignal_save #endif #define rsignal_state Perl_rsignal_state +#if defined(PERL_IN_PP_CTL_C) +#ifdef PERL_CORE +#define rxres_free S_rxres_free +#define rxres_restore S_rxres_restore +#endif +#endif #ifdef PERL_CORE -#define rxres_free Perl_rxres_free -#define rxres_restore Perl_rxres_restore #define rxres_save Perl_rxres_save #endif #if !defined(HAS_RENAME) @@ -3102,9 +3106,13 @@ #define rsignal_save(a,b,c) Perl_rsignal_save(aTHX_ a,b,c) #endif #define rsignal_state(a) Perl_rsignal_state(aTHX_ a) +#if defined(PERL_IN_PP_CTL_C) +#ifdef PERL_CORE +#define rxres_free(a) S_rxres_free(aTHX_ a) +#define rxres_restore(a,b) S_rxres_restore(aTHX_ a,b) +#endif +#endif #ifdef PERL_CORE -#define rxres_free(a) Perl_rxres_free(aTHX_ a) -#define rxres_restore(a,b) Perl_rxres_restore(aTHX_ a,b) #define rxres_save(a,b) Perl_rxres_save(aTHX_ a,b) #endif #if !defined(HAS_RENAME) diff --git a/pp_ctl.c b/pp_ctl.c index 8e89cb9..c8d5a3e 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -357,8 +357,8 @@ Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx) } } -void -Perl_rxres_restore(pTHX_ void **rsp, REGEXP *rx) +static void +S_rxres_restore(pTHX_ void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; @@ -387,8 +387,8 @@ Perl_rxres_restore(pTHX_ void **rsp, REGEXP *rx) } } -void -Perl_rxres_free(pTHX_ void **rsp) +static void +S_rxres_free(pTHX_ void **rsp) { UV * const p = (UV*)*rsp; diff --git a/proto.h b/proto.h index 18071f8..30faee8 100644 --- a/proto.h +++ b/proto.h @@ -2705,17 +2705,19 @@ PERL_CALLCONV int Perl_rsignal_save(pTHX_ int i, Sighandler_t t1, Sigsave_t* sav assert(save) PERL_CALLCONV Sighandler_t Perl_rsignal_state(pTHX_ int i); -PERL_CALLCONV void Perl_rxres_free(pTHX_ void** rsp) +#if defined(PERL_IN_PP_CTL_C) +STATIC void S_rxres_free(pTHX_ void** rsp) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_RXRES_FREE \ assert(rsp) -PERL_CALLCONV void Perl_rxres_restore(pTHX_ void **rsp, REGEXP *rx) +STATIC void S_rxres_restore(pTHX_ void **rsp, REGEXP *rx) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_RXRES_RESTORE \ assert(rsp); assert(rx) +#endif PERL_CALLCONV void Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2);