From 5f030f05b67dc31491c6ee616fd9d360adcedc61 Mon Sep 17 00:00:00 2001 From: kan Date: Wed, 2 Oct 2019 16:08:01 +0000 Subject: [PATCH] Revert r352953: Convert pnmatch to single element array in regexec calls Requested by: cem --- usr.bin/killall/killall.c | 14 +++++++------- usr.bin/split/split.c | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index 7a8d5fe36a20..aca0830c158b 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -98,7 +98,7 @@ main(int ac, char **av) struct stat sb; struct passwd *pw; regex_t rgx; - regmatch_t pmatch[1]; + regmatch_t pmatch; int i, j, ch; char buf[256]; char first; @@ -361,9 +361,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = strlen(thiscmd); - if (regexec(&rgx, thiscmd, 0, pmatch, + pmatch.rm_so = 0; + pmatch.rm_eo = strlen(thiscmd); + if (regexec(&rgx, thiscmd, 0, &pmatch, REG_STARTEND) != 0) matched = 0; regfree(&rgx); @@ -387,9 +387,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = strlen(thiscmd); - if (regexec(&rgx, thiscmd, 0, pmatch, + pmatch.rm_so = 0; + pmatch.rm_eo = strlen(thiscmd); + if (regexec(&rgx, thiscmd, 0, &pmatch, REG_STARTEND) == 0) matched = 1; regfree(&rgx); diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 46f6ec03a32d..9028b29d1c69 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -281,11 +281,11 @@ split2(void) /* Check if we need to start a new file */ if (pflag) { - regmatch_t pmatch[1]; + regmatch_t pmatch; - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = len - 1; - if (regexec(&rgx, bfr, 0, pmatch, REG_STARTEND) == 0) + pmatch.rm_so = 0; + pmatch.rm_eo = len - 1; + if (regexec(&rgx, bfr, 0, &pmatch, REG_STARTEND) == 0) newfile(); } else if (lcnt++ == numlines) { newfile();