This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use embed.pl inline capabilities for regcurly
authorKarl Williamson <public@khwilliamson.com>
Sat, 29 Jan 2011 17:11:39 +0000 (10:11 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 29 Jan 2011 17:26:41 +0000 (10:26 -0700)
Change the regcurly definition to use the new inline abilities.

dquote_static.c
embed.fnc
embed.h
proto.h

index fbd8c38..5321221 100644 (file)
@@ -7,24 +7,18 @@
  * It is currently #included by regcomp.c and toke.c.
 */
 
+#define PERL_IN_DQUOTE_STATIC_C
+#include "proto.h"
+#include "embed.h"
+
 /*
  - 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)
+S_regcurly(register const char *s)
 {
-    assert(s);
+    PERL_ARGS_ASSERT_REGCURLY;
 
     if (*s++ != '{')
        return FALSE;
index 13d8299..452856c 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -988,6 +988,9 @@ Ap  |char*  |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \
                                |NN char* strend|const U32 flags \
                                |NULLOK re_scream_pos_data *data
 Ap     |SV*    |re_intuit_string|NN REGEXP  *const r
+#if defined(PERL_IN_DQUOTE_STATIC_C)
+iPR    |I32    |regcurly       |NN const char *s
+#endif
 Ap     |I32    |regexec_flags  |NN REGEXP *const rx|NN char *stringarg \
                                |NN char *strend|NN char *strbeg|I32 minend \
                                |NN SV *sv|NULLOK void *data|U32 flags
diff --git a/embed.h b/embed.h
index 90e365f..133acd9 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define do_trans_simple(a)     S_do_trans_simple(aTHX_ a)
 #define do_trans_simple_utf8(a)        S_do_trans_simple_utf8(aTHX_ a)
 #  endif
+#  if defined(PERL_IN_DQUOTE_STATIC_C)
+#define regcurly(a)            S_regcurly(aTHX_ a)
+#  endif
 #  if defined(PERL_IN_DUMP_C)
 #define deb_curcv(a)           S_deb_curcv(aTHX_ a)
 #define debprof(a)             S_debprof(aTHX_ a)
diff --git a/proto.h b/proto.h
index 27dbc3a..829e451 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5179,6 +5179,15 @@ STATIC I32       S_do_trans_simple_utf8(pTHX_ SV * const sv)
        assert(sv)
 
 #endif
+#if defined(PERL_IN_DQUOTE_STATIC_C)
+PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s)
+                       __attribute__warn_unused_result__
+                       __attribute__pure__
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_REGCURLY      \
+       assert(s)
+
+#endif
 #if defined(PERL_IN_DUMP_C)
 STATIC CV*     S_deb_curcv(pTHX_ const I32 ix);
 STATIC void    S_debprof(pTHX_ const OP *o)