In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6e256d6843282fdbfc400027b4dd7313ab63caf1?hp=2748c776108ea3c2dab18eeb6a710e819486df17>
- Log ----------------------------------------------------------------- commit 6e256d6843282fdbfc400027b4dd7313ab63caf1 Author: Andy Dougherty <[email protected]> Date: Wed Sep 22 13:45:47 2010 -0400 Run perl regen.pl after removing regcurly from embed.fnc. Since regcurly is now a static inline function, it no longer needs to appear in embed.fnc. embed.pl doesn't quite have the right flags to deal with static inline functions, so I just removed regcurly entirely. It's not for embedding or exporting anyway. M embed.h M global.sym M proto.h commit 04e98a4df2ab89550ea2ab5f96ddd3932e2e1ec9 Author: Andy Dougherty <[email protected]> Date: Wed Sep 22 13:44:36 2010 -0400 Extract regcurly as a static inline function. This patch extracts regcurly from regcomp.c and converts it to a static inline function in a new file dquote_static.c that is now #included by regcomp.c and toke.c. This change will require 'make regen'. M MANIFEST A dquote_static.c M embed.fnc M regcomp.c M toke.c ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 + dquote_static.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ embed.fnc | 1 - embed.h | 6 ------ global.sym | 1 - proto.h | 7 ------- regcomp.c | 27 ++------------------------- toke.c | 1 + 8 files changed, 55 insertions(+), 40 deletions(-) create mode 100644 dquote_static.c diff --git a/MANIFEST b/MANIFEST index 3e9583a..4a5abf9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2997,6 +2997,7 @@ djgpp/fixpmain DOS/DJGPP port doio.c I/O operations doop.c Support code for various operations dosish.h Some defines for MS/DOSish machines +dquote_static.c Static functions for double quotish contexts dump.c Debugging output embed.fnc Database used by embed.pl embed.h Maps symbols to safer names diff --git a/dquote_static.c b/dquote_static.c new file mode 100644 index 0000000..c6d22e2 --- /dev/null +++ b/dquote_static.c @@ -0,0 +1,51 @@ +/* dquote_static.c + * + * This file contains static inline functions that are related to + * parsing double-quotish expressions, but are used in more than + * one file. + * + * It is currently #included by regcomp.c and toke.c. +*/ + +/* + - regcurly - a little FSA that accepts {\d+,?\d*} + Pulled from regcomp.c. + */ + +/* embed.pl doesn't yet know how to handle static inline functions, so + manually decorate it here with gcc-style attributes. +*/ +PERL_STATIC_INLINE I32 +regcurly(register const char *s) + __attribute__warn_unused_result__ + __attribute__pure__ + __attribute__nonnull__(1); + +PERL_STATIC_INLINE I32 +regcurly(register const char *s) +{ + assert(s); + + if (*s++ != '{') + return FALSE; + if (!isDIGIT(*s)) + return FALSE; + while (isDIGIT(*s)) + s++; + if (*s == ',') + s++; + while (isDIGIT(*s)) + s++; + if (*s != '}') + return FALSE; + return TRUE; +} +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * ex: set ts=8 sts=4 sw=4 noet: + */ diff --git a/embed.fnc b/embed.fnc index ebe3d7c..619a0be 100644 --- a/embed.fnc +++ b/embed.fnc @@ -169,7 +169,6 @@ npR |MEM_SIZE|malloc_good_size |size_t nbytes AnpR |void* |get_context Anp |void |set_context |NN void *t -EXpRnPM |I32 |regcurly |NN const char *s END_EXTERN_C diff --git a/embed.h b/embed.h index 89ae16b..d269611 100644 --- a/embed.h +++ b/embed.h @@ -43,9 +43,6 @@ #endif #define get_context Perl_get_context #define set_context Perl_set_context -#if defined(PERL_CORE) || defined(PERL_EXT) -#define regcurly Perl_regcurly -#endif #define amagic_call Perl_amagic_call #define Gv_AMupdate Perl_Gv_AMupdate #define gv_handler Perl_gv_handler @@ -2509,9 +2506,6 @@ #define get_context Perl_get_context #define set_context Perl_set_context #if defined(PERL_CORE) || defined(PERL_EXT) -#define regcurly Perl_regcurly -#endif -#if defined(PERL_CORE) || defined(PERL_EXT) #endif #define amagic_call(a,b,c,d) Perl_amagic_call(aTHX_ a,b,c,d) #define Gv_AMupdate(a,b) Perl_Gv_AMupdate(aTHX_ a,b) diff --git a/global.sym b/global.sym index 4670985..db75a27 100644 --- a/global.sym +++ b/global.sym @@ -31,7 +31,6 @@ Perl_realloc Perl_mfree Perl_get_context Perl_set_context -Perl_regcurly Perl_try_amagic_bin Perl_try_amagic_un Perl_amagic_call diff --git a/proto.h b/proto.h index 6b1e25b..91dae7c 100644 --- a/proto.h +++ b/proto.h @@ -119,13 +119,6 @@ PERL_CALLCONV void Perl_set_context(void *t) #define PERL_ARGS_ASSERT_SET_CONTEXT \ assert(t) -PERL_CALLCONV I32 Perl_regcurly(const char *s) - __attribute__warn_unused_result__ - __attribute__pure__ - __attribute__nonnull__(1); -#define PERL_ARGS_ASSERT_REGCURLY \ - assert(s) - END_EXTERN_C diff --git a/regcomp.c b/regcomp.c index 2871e4a..de95789 100644 --- a/regcomp.c +++ b/regcomp.c @@ -85,6 +85,8 @@ # include "regcomp.h" #endif +#include "dquote_static.c" + #ifdef op #undef op #endif /* op */ @@ -9006,31 +9008,6 @@ S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val, #endif /* - - regcurly - a little FSA that accepts {\d+,?\d*} - */ -#ifndef PERL_IN_XSUB_RE -I32 -Perl_regcurly(register const char *s) -{ - PERL_ARGS_ASSERT_REGCURLY; - - if (*s++ != '{') - return FALSE; - if (!isDIGIT(*s)) - return FALSE; - while (isDIGIT(*s)) - s++; - if (*s == ',') - s++; - while (isDIGIT(*s)) - s++; - if (*s != '}') - return FALSE; - return TRUE; -} -#endif - -/* - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form */ #ifdef DEBUGGING diff --git a/toke.c b/toke.c index c4ff0c2..961866b 100644 --- a/toke.c +++ b/toke.c @@ -39,6 +39,7 @@ Individual members of C<PL_parser> have their own documentation. #include "EXTERN.h" #define PERL_IN_TOKE_C #include "perl.h" +#include "dquote_static.c" #define new_constant(a,b,c,d,e,f,g) \ S_new_constant(aTHX_ a,b,STR_WITH_LEN(c),d,e,f, g) -- Perl5 Master Repository
