From 5c0f85ef5653741c0f98cda1d31c11f2af8d121c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 4 Mar 2014 17:55:10 -0700 Subject: [PATCH] regcomp.c: Use minimal struct formal parameter 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 | 2 +- proto.h | 2 +- regcomp.c | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/embed.fnc b/embed.fnc index 83e80cc..66c16d6 100644 --- 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 --- 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 \ diff --git a/regcomp.c b/regcomp.c index 2c94b43..c5dbe13 100644 --- 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; } -- 2.7.4