Skip to content

Commit

Permalink
Revert r352953: Convert pnmatch to single element array in regexec calls
Browse files Browse the repository at this point in the history
Requested by: cem
  • Loading branch information
akabaev committed Oct 2, 2019
1 parent 4a7b33e commit bcd34af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions usr.bin/killall/killall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions usr.bin/split/split.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bcd34af

Please sign in to comment.