aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-01-19 21:08:42 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-01-19 21:08:42 +0200
commitfb5edec7717ee9759785c8671fe71623dfee23a2 (patch)
treed96366f5b796710a0f894d9ffad059f472291fd6 /io.c
parent659ea6112338c501188deb81b679b7db05b5b054 (diff)
parent5a619e1986724cf8e27b637509925a8da36837e8 (diff)
downloadegawk-fb5edec7717ee9759785c8671fe71623dfee23a2.tar.gz
egawk-fb5edec7717ee9759785c8671fe71623dfee23a2.tar.bz2
egawk-fb5edec7717ee9759785c8671fe71623dfee23a2.zip
Merge branch 'master' into feature/api-mpfr
Diffstat (limited to 'io.c')
-rw-r--r--io.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/io.c b/io.c
index 688723fd..d65f2aaa 100644
--- a/io.c
+++ b/io.c
@@ -318,8 +318,7 @@ static long read_default_timeout;
static struct redirect *red_head = NULL;
static NODE *RS = NULL;
-static Regexp *RS_re_yes_case; /* regexp for RS when ignoring case */
-static Regexp *RS_re_no_case; /* regexp for RS when not ignoring case */
+static Regexp *RS_re[2]; /* index 0 - don't ignore case, index 1, do */
static Regexp *RS_regexp;
static const char nonfatal[] = "NONFATAL";
@@ -3870,7 +3869,7 @@ set_RS()
* set_IGNORECASE() relies on this routine to call
* set_FS().
*/
- RS_regexp = (IGNORECASE ? RS_re_no_case : RS_re_yes_case);
+ RS_regexp = RS_re[IGNORECASE];
goto set_FS;
}
unref(save_rs);
@@ -3882,9 +3881,9 @@ set_RS()
* Please do not remerge the if condition; hinders memory deallocation
* in case of fatal error in make_regexp.
*/
- refree(RS_re_yes_case); /* NULL argument is ok */
- refree(RS_re_no_case);
- RS_re_yes_case = RS_re_no_case = RS_regexp = NULL;
+ refree(RS_re[0]); /* NULL argument is ok */
+ refree(RS_re[1]);
+ RS_re[0] = RS_re[1] = RS_regexp = NULL;
if (RS->stlen == 0) {
RS_is_null = true;
@@ -3892,9 +3891,9 @@ set_RS()
} else if (RS->stlen > 1 && ! do_traditional) {
static bool warned = false;
- RS_re_yes_case = make_regexp(RS->stptr, RS->stlen, false, true, true);
- RS_re_no_case = make_regexp(RS->stptr, RS->stlen, true, true, true);
- RS_regexp = (IGNORECASE ? RS_re_no_case : RS_re_yes_case);
+ RS_re[0] = make_regexp(RS->stptr, RS->stlen, false, true, true);
+ RS_re[1] = make_regexp(RS->stptr, RS->stlen, true, true, true);
+ RS_regexp = RS_re[IGNORECASE];
matchrec = rsrescan;