This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Use minimal struct formal parameter
authorKarl Williamson <public@khwilliamson.com>
Wed, 5 Mar 2014 00:55:10 +0000 (17:55 -0700)
committerKarl Williamson <public@khwilliamson.com>
Wed, 5 Mar 2014 01:08:27 +0000 (18:08 -0700)
The static function get_ANYOF_cp_list_for_ssc() takes a struct formal
parameter that is a superset of what it actually uses.  The calls to it
have to cast to that superset.  By setting the parameter to the smallest
structure it uses, we simplify things.

embed.fnc
proto.h
regcomp.c

index 83e80cc..66c16d6 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2103,7 +2103,7 @@ Es        |void   |ssc_or         |NN const RExC_state_t *pRExC_state \
                                |NN const regnode_charclass *or_with
 Es     |SV*    |get_ANYOF_cp_list_for_ssc                                 \
                                |NN const RExC_state_t *pRExC_state \
-                               |NN const regnode_charclass_posixl* const node
+                               |NN const regnode_charclass* const node
 Ei     |void   |ssc_intersection|NN regnode_ssc *ssc \
                                |NN SV* const invlist|const bool invert_2nd
 Ei     |void   |ssc_union      |NN regnode_ssc *ssc \
diff --git a/proto.h b/proto.h
index 726f270..87f06c5 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -6629,7 +6629,7 @@ STATIC bool       S_could_it_be_a_POSIX_class(pTHX_ RExC_state_t *pRExC_state)
 #define PERL_ARGS_ASSERT_COULD_IT_BE_A_POSIX_CLASS     \
        assert(pRExC_state)
 
-STATIC SV*     S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass_posixl* const node)
+STATIC SV*     S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass* const node)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC     \
index 2c94b43..c5dbe13 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -999,7 +999,7 @@ S_ssc_is_cp_posixl_init(pTHX_ const RExC_state_t *pRExC_state,
 
 STATIC SV*
 S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state,
-                               const regnode_charclass_posixl* const node)
+                               const regnode_charclass* const node)
 {
     /* Returns a mortal inversion list defining which code points are matched
      * by 'node', which is of type ANYOF.  Handles complementing the result if
@@ -1153,8 +1153,7 @@ S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc,
         }
     }
     else {
-        anded_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state,
-                                     (regnode_charclass_posixl*) and_with);
+        anded_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state, and_with);
         anded_flags = ANYOF_FLAGS(and_with) & ANYOF_COMMON_FLAGS;
     }
 
@@ -1304,8 +1303,7 @@ S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc,
         ored_flags = ANYOF_FLAGS(or_with);
     }
     else {
-        ored_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state,
-                                     (regnode_charclass_posixl*) or_with);
+        ored_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state, or_with);
         ored_flags = ANYOF_FLAGS(or_with) & ANYOF_COMMON_FLAGS;
     }