Date: Wed, 14 Sep 2011 00:40:00 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225542 - user/gabor/grep/trunk Message-ID: <201109140040.p8E0e0qP003256@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Wed Sep 14 00:40:00 2011 New Revision: 225542 URL: http://svn.freebsd.org/changeset/base/225542 Log: - Failing fixncomp() does not always mean the pattern is invalid, e.g. MBS with REG_ICASE cannot be handled by the fast matcher. Furthermore, fastncomp() always catches fix patterns so the distinction is not really necessary, it just makes the code longer. Reported by: aakuusta@gmail.com Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Tue Sep 13 23:28:04 2011 (r225541) +++ user/gabor/grep/trunk/grep.c Wed Sep 14 00:40:00 2011 (r225542) @@ -685,29 +685,17 @@ main(int argc, char *argv[]) r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Check if cheating is allowed (always is for fgrep). */ - if (grepbehave == GREP_FIXED) { - for (i = 0; i < patterns; ++i) { - c = fixncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags); + for (i = 0; i < patterns; ++i) { + if (fastncomp(&fg_pattern[i], pattern[i].pat, + pattern[i].len, cflags) != 0) { + /* Fall back to full regex library */ + c = regcomp(&r_pattern[i], pattern[i].pat, cflags); if (c != 0) { regerror(c, &r_pattern[i], re_error, RE_ERROR_BUF); errx(2, "%s", re_error); } } - } else { - for (i = 0; i < patterns; ++i) { - if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) != 0) { - /* Fall back to full regex library */ - c = regcomp(&r_pattern[i], pattern[i].pat, cflags); - if (c != 0) { - regerror(c, &r_pattern[i], re_error, - RE_ERROR_BUF); - errx(2, "%s", re_error); - } - } - } } if (lbflag)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109140040.p8E0e0qP003256>