From 5d3d13d10da5429b4c98a44ea398eb3cfb8c457b Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 25 Aug 2012 08:58:42 -0600 Subject: 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 to indicate it needs to be dereferenced. --- utf8.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'utf8.c') diff --git a/utf8.c b/utf8.c index b12d82c0ef..b25c701d4e 100644 --- a/utf8.c +++ b/utf8.c @@ -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: , * , and . 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_ -- cgit v1.2.1