summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-10-26 21:38:09 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-10-27 07:02:05 -0400
commit7416fd9e8d92c85fa079691fa8539df44e63b3e6 (patch)
treedd82a86f0722b3349ed4c74294ccc4923772e055
parent66d33016a779b6b40236863ff1e749b3a1757c31 (diff)
downloadperl-7416fd9e8d92c85fa079691fa8539df44e63b3e6.tar.gz
Replace two ugly casts in reg_recode() calls.
With one ugly cast inside the reg_recode() call.
-rw-r--r--embed.fnc2
-rw-r--r--proto.h2
-rw-r--r--regcomp.c8
3 files changed, 6 insertions, 6 deletions
diff --git a/embed.fnc b/embed.fnc
index 096a92e5d8..c7dfead085 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -2143,7 +2143,7 @@ Es |regnode*|handle_regex_sets|NN RExC_state_t *pRExC_state \
|NN char * const oregcomp_parse
Es |void|parse_lparen_question_flags|NN RExC_state_t *pRExC_state
Es |regnode*|reg_node |NN RExC_state_t *pRExC_state|U8 op
-Es |UV |reg_recode |const char value|NN SV **encp
+Es |UV |reg_recode |const U8 value|NN SV **encp
Es |regnode*|regpiece |NN RExC_state_t *pRExC_state \
|NN I32 *flagp|U32 depth
Es |bool |grok_bslash_N |NN RExC_state_t *pRExC_state \
diff --git a/proto.h b/proto.h
index 7d7fe88d5a..210d0131d3 100644
--- a/proto.h
+++ b/proto.h
@@ -4753,7 +4753,7 @@ STATIC regnode* S_reg2Lanode(pTHX_ RExC_state_t *pRExC_state, const U8 op, const
STATIC regnode* S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op);
#define PERL_ARGS_ASSERT_REG_NODE \
assert(pRExC_state)
-STATIC UV S_reg_recode(pTHX_ const char value, SV **encp);
+STATIC UV S_reg_recode(pTHX_ const U8 value, SV **encp);
#define PERL_ARGS_ASSERT_REG_RECODE \
assert(encp)
STATIC SV * S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags);
diff --git a/regcomp.c b/regcomp.c
index e4cb08310d..b170c4da60 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -11423,10 +11423,10 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
* it returns U+FFFD (Replacement character) and sets *encp to NULL.
*/
STATIC UV
-S_reg_recode(pTHX_ const char value, SV **encp)
+S_reg_recode(pTHX_ const U8 value, SV **encp)
{
STRLEN numlen = 1;
- SV * const sv = newSVpvn_flags(&value, numlen, SVs_TEMP);
+ SV * const sv = newSVpvn_flags((const char *) &value, numlen, SVs_TEMP);
const char * const s = *encp ? sv_recode_to_utf8(sv, *encp) : SvPVX(sv);
const STRLEN newlen = SvCUR(sv);
UV uv = UNICODE_REPLACEMENT;
@@ -12617,7 +12617,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
recode_encoding:
if (! RExC_override_recoding) {
SV* enc = _get_encoding();
- ender = reg_recode((const char)(U8)ender, &enc);
+ ender = reg_recode((U8)ender, &enc);
if (!enc && PASS2)
ckWARNreg(p, "Invalid escape in the specified encoding");
REQUIRE_UTF8(flagp);
@@ -14905,7 +14905,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
recode_encoding:
if (! RExC_override_recoding) {
SV* enc = _get_encoding();
- value = reg_recode((const char)(U8)value, &enc);
+ value = reg_recode((U8)value, &enc);
if (!enc) {
if (strict) {
vFAIL("Invalid escape in the specified encoding");