aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-10-11 16:39:24 +0300
committerArnold D. Robbins <arnold@skeeve.com>2020-10-11 16:39:24 +0300
commita3e187cbb5c9ef951152f18fee1d36c93e4abbe5 (patch)
tree9f351195b64fbaa4a856b18510007a6eaa897c16
parentdd9b0921ee9a6918279b3245d4373fdd1180ee13 (diff)
downloadegawk-a3e187cbb5c9ef951152f18fee1d36c93e4abbe5.tar.gz
egawk-a3e187cbb5c9ef951152f18fee1d36c93e4abbe5.tar.bz2
egawk-a3e187cbb5c9ef951152f18fee1d36c93e4abbe5.zip
Small improvement for regexp maybe_long criteria.
-rw-r--r--ChangeLog6
-rw-r--r--io.c2
-rw-r--r--re.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 84491dcc..f5bc0822 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-10-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * re.c (make_regexp): Add {} to characters that cause rp->maybe_long
+ to be true.
+ * io.c (rsrescan): Update comment for step 4.
+
2020-09-21 Arnold D. Robbins <arnold@skeeve.com>
* awk.h (enum redirect_flags): Add RED_NONE.
diff --git a/io.c b/io.c
index 1fb95873..2714398e 100644
--- a/io.c
+++ b/io.c
@@ -3753,7 +3753,7 @@ again:
* "abc" into the front of the next record. Ooops.
*
* The re->maybe_long member is true if the
- * regex contains one of: + * ? |. This is a very
+ * regex contains one of: + * ? | { }. This is a very
* simple heuristic, but in combination with the
* "end of match within a few bytes of end of buffer"
* check, should keep things reasonable.
diff --git a/re.c b/re.c
index a23e7f6c..fb28c563 100644
--- a/re.c
+++ b/re.c
@@ -282,7 +282,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal)
}
for (i = len - 1; i >= 0; i--) {
- if (strchr("*+|?", buf[i]) != NULL) {
+ if (strchr("*+|?{}", buf[i]) != NULL) {
rp->maybe_long = true;
break;
}