This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Extract code into separate function
authorKarl Williamson <public@khwilliamson.com>
Wed, 14 Aug 2013 17:09:58 +0000 (11:09 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 24 Sep 2013 17:36:13 +0000 (11:36 -0600)
A future commit will use this functionality from a second place.  For
now, just cut and paste, and do the minimal ancillary work to get it to
compile and pass.

embed.fnc
embed.h
proto.h
regcomp.c

index 55e3f36..e34af13 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2004,6 +2004,13 @@ Es       |regnode*|regbranch     |NN struct RExC_state_t *pRExC_state \
                                |NN I32 *flagp|I32 first|U32 depth
 Es     |STRLEN |reguni         |NN const struct RExC_state_t *pRExC_state \
                                |UV uv|NN char *s
+Es     |void    |set_ANYOF_arg |NN struct RExC_state_t* const pRExC_state \
+                               |NN regnode* const ret                     \
+                               |NULLOK SV* const cp_list                  \
+                               |NN SV* const listsv                       \
+                               |const STRLEN initial_listsv_len           \
+                               |NULLOK SV* const swash                    \
+                               |const bool has_user_defined_property
 Es     |regnode*|regclass      |NN struct RExC_state_t *pRExC_state \
                                |NN I32 *flagp|U32 depth|const bool stop_at_1 \
                                |bool allow_multi_fold                        \
diff --git a/embed.h b/embed.h
index 1cd99f2..0a7087d 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define reguni(a,b,c)          S_reguni(aTHX_ a,b,c)
 #define regwhite               S_regwhite
 #define scan_commit(a,b,c,d)   S_scan_commit(aTHX_ a,b,c,d)
+#define set_ANYOF_arg(a,b,c,d,e,f,g)   S_set_ANYOF_arg(aTHX_ a,b,c,d,e,f,g)
 #define study_chunk(a,b,c,d,e,f,g,h,i,j,k)     S_study_chunk(aTHX_ a,b,c,d,e,f,g,h,i,j,k)
 #  endif
 #  if defined(PERL_IN_REGCOMP_C) || defined (PERL_IN_DUMP_C)
diff --git a/proto.h b/proto.h
index 9519518..6f41f4f 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -6835,6 +6835,13 @@ STATIC void      S_scan_commit(pTHX_ const struct RExC_state_t *pRExC_state, struct s
 #define PERL_ARGS_ASSERT_SCAN_COMMIT   \
        assert(pRExC_state); assert(data); assert(minlenp)
 
+STATIC void    S_set_ANYOF_arg(pTHX_ struct RExC_state_t* const pRExC_state, regnode* const ret, SV* const cp_list, SV* const listsv, const STRLEN initial_listsv_len, SV* const swash, const bool has_user_defined_property)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_SET_ANYOF_ARG \
+       assert(pRExC_state); assert(ret); assert(listsv)
+
 STATIC SSize_t S_study_chunk(pTHX_ struct RExC_state_t *pRExC_state, regnode **scanp, SSize_t *minlenp, SSize_t *deltap, regnode *last, struct scan_data_t *data, I32 stopparen, U8* recursed, regnode_ssc *and_withp, U32 flags, U32 depth)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2)
index b6bdaf0..538cf32 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -14028,6 +14028,26 @@ parseit:
        swash = NULL;
     }
 
+    set_ANYOF_arg(pRExC_state, ret, cp_list,
+                  listsv, initial_listsv_len,
+                  swash, has_user_defined_property);
+
+    *flagp |= HASWIDTH|SIMPLE;
+    return ret;
+}
+
+STATIC void
+S_set_ANYOF_arg(pTHX_ struct RExC_state_t* const pRExC_state,
+                regnode* const ret,
+                SV* const cp_list,
+                SV* const listsv, const STRLEN initial_listsv_len,
+                SV* const swash,
+                const bool has_user_defined_property)
+{
+    UV n;
+
+    PERL_ARGS_ASSERT_SET_ANYOF_ARG;
+
     if (! cp_list
        && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION)
     {
@@ -14072,10 +14092,8 @@ parseit:
        RExC_rxi->data->data[n] = (void*)rv;
        ARG_SET(ret, n);
     }
-
-    *flagp |= HASWIDTH|SIMPLE;
-    return ret;
 }
+
 #undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION