summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-01-14 17:55:24 -0700
committerKarl Williamson <khw@cpan.org>2018-02-20 01:37:24 -0700
commitaa664f48918ef63c2436b3109fee3a49b3ffc592 (patch)
tree3a56508406f2b1f7d1dfce18393ad8f1a30332c5 /regcomp.c
parentd164443fe7708a332f3408f2a842d986b3148cbb (diff)
downloadperl-aa664f48918ef63c2436b3109fee3a49b3ffc592.tar.gz
regcomp.c: Refactor some if-elses
if (foo) { ... return } else { stuff } is equivalent to if (foo) { ... return } stuff This commit changes the former to the latter, which also means moving some declarations earlier, and some intialization later, and removing some no longer valid code. This will be useful in the next commit.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/regcomp.c b/regcomp.c
index cb5dd98d8c..34ac9169f2 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -12311,6 +12311,12 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
stream */
char* p = RExC_parse; /* Temporary */
+ SV * substitute_parse;
+ STRLEN len;
+ char *orig_end;
+ char *save_start;
+ I32 flags;
+
GET_RE_DEBUG_FLAGS_DECL;
PERL_ARGS_ASSERT_GROK_BSLASH_N;
@@ -12455,12 +12461,8 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
RExC_parse = endbrace + 1;
return TRUE;
}
- else { /* Is a multiple character sequence */
- SV * substitute_parse;
- STRLEN len;
- char *orig_end = RExC_end;
- char *save_start = RExC_start;
- I32 flags;
+
+ /* Here, is a multiple character sequence */
/* Count the code points, if desired, in the sequence */
if (cp_count) {
@@ -12513,10 +12515,6 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
vFAIL("Invalid hexadecimal number in \\N{U+...}");
}
- RExC_parse = RExC_start = RExC_adjusted_start
- = SvPV_nolen(substitute_parse);
- RExC_end = RExC_parse + len;
-
/* The values are Unicode, and therefore not subject to recoding, but
* have to be converted to native on a non-Unicode (meaning non-ASCII)
* platform. */
@@ -12524,6 +12522,13 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
RExC_recode_x_to_native = 1;
#endif
+ save_start = RExC_start;
+ orig_end = RExC_end;
+
+ RExC_parse = RExC_start = RExC_adjusted_start = SvPV(substitute_parse,
+ len);
+ RExC_end = RExC_parse + len;
+
*node_p = reg(pRExC_state, 1, &flags, depth+1);
/* Restore the saved values */
@@ -12546,7 +12551,6 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
nextchar(pRExC_state);
return TRUE;
- }
}