aboutsummaryrefslogtreecommitdiff
path: root/text-regex.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-01-31 23:33:28 -0800
committerMarc André Tanner <mat@brain-dump.org>2020-04-27 10:45:42 +0200
commitdf147e98df6210511b3569d51e02b021ef34063b (patch)
tree989c6f6ed31477914bca514dd2e06c5dd22f84e6 /text-regex.c
parent348cf46dcbca5fecb342b59144a3ef6b36c3c857 (diff)
downloadvis-df147e98df6210511b3569d51e02b021ef34063b.tar.gz
vis-df147e98df6210511b3569d51e02b021ef34063b.tar.xz
Avoid use of VLAs
Diffstat (limited to 'text-regex.c')
-rw-r--r--text-regex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/text-regex.c b/text-regex.c
index 56ecafc..7c6812e 100644
--- a/text-regex.c
+++ b/text-regex.c
@@ -45,7 +45,7 @@ int text_search_range_forward(Text *txt, size_t pos, size_t len, Regex *r, size_
return REG_NOMATCH;
char *cur = buf, *end = buf + len;
int ret = REG_NOMATCH;
- regmatch_t match[nmatch];
+ regmatch_t match[MAX_REGEX_SUB];
for (size_t junk = len; len > 0; len -= junk, pos += junk) {
ret = regexec(&r->regex, cur, nmatch, match, eflags);
if (!ret) {
@@ -73,7 +73,7 @@ int text_search_range_backward(Text *txt, size_t pos, size_t len, Regex *r, size
return REG_NOMATCH;
char *cur = buf, *end = buf + len;
int ret = REG_NOMATCH;
- regmatch_t match[nmatch];
+ regmatch_t match[MAX_REGEX_SUB];
for (size_t junk = len; len > 0; len -= junk, pos += junk) {
char *next;
if (!regexec(&r->regex, cur, nmatch, match, eflags)) {