Skip to content

Commit 449cfab

Browse files
committed
RExC_state_t: convert (orig_)utf8 to boolean
1 parent 6159afc commit 449cfab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

regcomp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ S_pat_upgrade_to_utf8(pTHX_ RExC_state_t * const pRExC_state,
595595
*plen_p = d - dst;
596596
*pat_p = (char*) dst;
597597
SAVEFREEPV(*pat_p);
598-
RExC_orig_utf8 = RExC_utf8 = 1;
598+
RExC_orig_utf8 = RExC_utf8 = true;
599599
}
600600

601601

@@ -1602,7 +1602,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
16021602
}
16031603

16041604
/* ignore the utf8ness if the pattern is 0 length */
1605-
RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat);
1605+
RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? false : cBOOL(SvUTF8(pat));
16061606
RExC_strict = cBOOL(pm_flags & RXf_PMf_STRICT);
16071607

16081608

@@ -1637,7 +1637,7 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
16371637

16381638
if ( old_re
16391639
&& !recompile
1640-
&& cBOOL(RX_UTF8(old_re)) == cBOOL(RExC_utf8)
1640+
&& cBOOL(RX_UTF8(old_re)) == RExC_utf8
16411641
&& ( RX_COMPFLAGS(old_re) == ( orig_rx_flags & RXf_PMf_FLAGCOPYMASK ) )
16421642
&& RX_PRELEN(old_re) == plen
16431643
&& memEQ(RX_PRECOMP(old_re), exp, plen)

regcomp_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ struct RExC_state_t {
127127
accept */
128128
I32 seen_zerolen;
129129
regnode *end_op; /* END node in program */
130-
I32 utf8; /* whether the pattern is utf8 or not */
131-
I32 orig_utf8; /* whether the pattern was originally in utf8 */
130+
bool utf8; /* whether the pattern is utf8 or not */
131+
bool orig_utf8; /* whether the pattern was originally in utf8 */
132132
/* XXX use this for future optimisation of case
133133
* where pattern must be upgraded to utf8. */
134134
I32 uni_semantics; /* If a d charset modifier should use unicode
@@ -740,7 +740,7 @@ static const scan_data_t zero_scan_data = {
740740

741741

742742

743-
#define UTF cBOOL(RExC_utf8)
743+
#define UTF RExC_utf8
744744

745745
/* The enums for all these are ordered so things work out correctly */
746746
#define LOC (get_regex_charset(RExC_flags) == REGEX_LOCALE_CHARSET)

0 commit comments

Comments
 (0)