diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-08-25 08:58:42 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-08-25 23:21:29 -0600 |
commit | 5d3d13d10da5429b4c98a44ea398eb3cfb8c457b (patch) | |
tree | 3bfb087559d3d4550910610254f8cda2fb4397eb | |
parent | ab20d70a9a23debea96660523e287da51405d7de (diff) | |
download | perl-5d3d13d10da5429b4c98a44ea398eb3cfb8c457b.tar.gz |
utf8.c: collapse a function parameter
Now that we have a flags parameter, we can get put this parameter as
just another flag, giving a cleaner interface to this internal-only
function. This also renames the flag parameter to <flag_p> to indicate
it needs to be dereferenced.
-rw-r--r-- | embed.fnc | 2 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | regcomp.c | 6 | ||||
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | utf8.c | 10 | ||||
-rw-r--r-- | utf8.h | 1 |
7 files changed, 12 insertions, 13 deletions
@@ -1419,7 +1419,7 @@ EXMp |void |_invlist_populate_swatch |NN SV* const invlist|const UV start|cons #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) EXp |SV* |_core_swash_init|NN const char* pkg|NN const char* name \ - |NN SV* listsv|I32 minbits|I32 none|bool return_if_undef \ + |NN SV* listsv|I32 minbits|I32 none \ |NULLOK SV* invlist|NULLOK U8* const flags_p EXMpR |SV* |_invlist_contents|NN SV* const invlist EiMR |UV* |_get_invlist_len_addr |NN SV* invlist @@ -952,7 +952,7 @@ #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_REGEXEC_C) || defined(PERL_IN_UTF8_C) -#define _core_swash_init(a,b,c,d,e,f,g,h) Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g,h) +#define _core_swash_init(a,b,c,d,e,f,g) Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g) #define _get_invlist_len_addr(a) S__get_invlist_len_addr(aTHX_ a) #define _get_swash_invlist(a) Perl__get_swash_invlist(aTHX_ a) #define _invlist_contains_cp(a,b) S__invlist_contains_cp(aTHX_ a,b) @@ -6674,7 +6674,7 @@ STATIC I32 S_study_chunk(pTHX_ struct RExC_state_t *pRExC_state, regnode **scanp #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) -PERL_CALLCONV SV* Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV* listsv, I32 minbits, I32 none, bool return_if_undef, SV* invlist, U8* const flags_p) +PERL_CALLCONV SV* Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV* listsv, I32 minbits, I32 none, SV* invlist, U8* const flags_p) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -11541,7 +11541,9 @@ parseit: case 'P': { char *e; - U8 swash_init_flags = 0; + + /* This routine will handle any undefined properties */ + U8 swash_init_flags = _CORE_SWASH_INIT_RETURN_IF_UNDEF; if (RExC_parse >= RExC_end) vFAIL2("Empty \\%c{}", (U8)value); @@ -11597,8 +11599,6 @@ parseit: swash = _core_swash_init("utf8", name, &PL_sv_undef, 1, /* binary */ 0, /* not tr/// */ - TRUE, /* this routine will handle - undefined properties */ NULL, /* No inversion list */ &swash_init_flags ); @@ -6718,8 +6718,6 @@ S_core_regclass_swash(pTHX_ const regexp *prog, register const regnode* node, bo si, 1, /* binary */ 0, /* not from tr/// */ - FALSE, /* is error if can't find - property */ invlist, &swash_init_flags); (void)av_store(av, 1, sw); @@ -2914,11 +2914,11 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits * public interface, and returning a copy prevents others from doing * mischief on the original */ - return newSVsv(_core_swash_init(pkg, name, listsv, minbits, none, FALSE, NULL, NULL)); + return newSVsv(_core_swash_init(pkg, name, listsv, minbits, none, NULL, NULL)); } SV* -Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits, I32 none, bool return_if_undef, SV* invlist, U8* const flags_p) +Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits, I32 none, SV* invlist, U8* const flags_p) { /* Initialize and return a swash, creating it if necessary. It does this * by calling utf8_heavy.pl in the general case. @@ -2937,8 +2937,6 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m * minbits is the number of bits required to represent each data element. * It is '1' for binary properties. * none I (khw) do not understand this one, but it is used only in tr///. - * return_if_undef is TRUE if the routine shouldn't croak if it can't find - * the requested property * invlist is an inversion list to initialize the swash with (or NULL) * flags_p if non-NULL is the address of various input and output flag bits * to the routine, as follows: ('I' means is input to the routine; @@ -2946,6 +2944,8 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m * meaningful on return.) * _CORE_SWASH_INIT_USER_DEFINED_PROPERTY indicates if the swash * came from a user-defined property. (I O) + * _CORE_SWASH_INIT_RETURN_IF_UNDEF indicates that instead of croaking + * when the swash cannot be located, to simply return NULL. (I) * * Thus there are three possible inputs to find the swash: <name>, * <listsv>, and <invlist>. At least one must be specified. The result @@ -3028,7 +3028,7 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m if (SvPOK(retval)) /* If caller wants to handle missing properties, let them */ - if (return_if_undef) { + if (flags_p && *flags_p & _CORE_SWASH_INIT_RETURN_IF_UNDEF) { return NULL; } Perl_croak(aTHX_ @@ -24,6 +24,7 @@ /* For _core_swash_init(), internal core use only */ #define _CORE_SWASH_INIT_USER_DEFINED_PROPERTY 0x1 +#define _CORE_SWASH_INIT_RETURN_IF_UNDEF 0x2 #define to_uni_fold(c, p, lenp) _to_uni_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) #define to_utf8_fold(c, p, lenp) _to_utf8_fold_flags(c, p, lenp, \ |