From owner-svn-src-user@FreeBSD.ORG Sun Oct 16 11:08:51 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AC72106566B; Sun, 16 Oct 2011 11:08:51 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A1008FC12; Sun, 16 Oct 2011 11:08:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9GB8prS059709; Sun, 16 Oct 2011 11:08:51 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9GB8pcj059704; Sun, 16 Oct 2011 11:08:51 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201110161108.p9GB8pcj059704@svn.freebsd.org> From: Gabor Kovesdan Date: Sun, 16 Oct 2011 11:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226432 - in user/gabor/tre-integration/usr.bin/grep: . regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 11:08:51 -0000 Author: gabor Date: Sun Oct 16 11:08:51 2011 New Revision: 226432 URL: http://svn.freebsd.org/changeset/base/226432 Log: - Fixup after MFC Deleted: user/gabor/tre-integration/usr.bin/grep/regex/ Modified: user/gabor/tre-integration/usr.bin/grep/Makefile user/gabor/tre-integration/usr.bin/grep/grep.c user/gabor/tre-integration/usr.bin/grep/grep.h user/gabor/tre-integration/usr.bin/grep/util.c Modified: user/gabor/tre-integration/usr.bin/grep/Makefile ============================================================================== --- user/gabor/tre-integration/usr.bin/grep/Makefile Sun Oct 16 10:58:00 2011 (r226431) +++ user/gabor/tre-integration/usr.bin/grep/Makefile Sun Oct 16 11:08:51 2011 (r226432) @@ -15,11 +15,6 @@ bsdgrep.1: grep.1 .endif SRCS= file.c grep.c queue.c util.c -# Extra files ported backported form some regex improvements -.PATH: ${.CURDIR}/regex -SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c -CFLAGS+=-I${.CURDIR}/regex - .if ${MK_BSD_GREP} == "yes" LINKS= ${BINDIR}/grep ${BINDIR}/egrep \ ${BINDIR}/grep ${BINDIR}/fgrep \ Modified: user/gabor/tre-integration/usr.bin/grep/grep.c ============================================================================== --- user/gabor/tre-integration/usr.bin/grep/grep.c Sun Oct 16 10:58:00 2011 (r226431) +++ user/gabor/tre-integration/usr.bin/grep/grep.c Sun Oct 16 11:08:51 2011 (r226432) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "fastmatch.h" #include "grep.h" #ifndef WITHOUT_NLS @@ -85,7 +84,6 @@ bool matchall; unsigned int patterns, pattern_sz; struct pat *pattern; regex_t *r_pattern; -fastmatch_t *fg_pattern; /* Filename exclusion/inclusion patterns */ unsigned int fpatterns, fpattern_sz; @@ -669,13 +667,10 @@ main(int argc, char *argv[]) } switch (grepbehave) { - cflags |= REG_LITERAL; - break; case GREP_BASIC: break; case GREP_FIXED: - /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */ - cflags |= 0020; + cflags |= REG_LITERAL; break; case GREP_EXTENDED: cflags |= REG_EXTENDED; @@ -689,15 +684,12 @@ main(int argc, char *argv[]) /* Check if cheating is allowed (always is for fgrep). */ 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); - } + /* 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); } } Modified: user/gabor/tre-integration/usr.bin/grep/grep.h ============================================================================== --- user/gabor/tre-integration/usr.bin/grep/grep.h Sun Oct 16 10:58:00 2011 (r226431) +++ user/gabor/tre-integration/usr.bin/grep/grep.h Sun Oct 16 11:08:51 2011 (r226432) @@ -36,8 +36,6 @@ #include #include -#include "fastmatch.h" - #ifdef WITHOUT_NLS #define getstr(n) errstr[n] #else @@ -125,7 +123,6 @@ extern unsigned int dpatterns, fpatterns extern struct pat *pattern; extern struct epat *dpattern, *fpattern; extern regex_t *er_pattern, *r_pattern; -extern fastmatch_t *fg_pattern; /* For regex errors */ #define RE_ERROR_BUF 512 Modified: user/gabor/tre-integration/usr.bin/grep/util.c ============================================================================== --- user/gabor/tre-integration/usr.bin/grep/util.c Sun Oct 16 10:58:00 2011 (r226431) +++ user/gabor/tre-integration/usr.bin/grep/util.c Sun Oct 16 11:08:51 2011 (r226432) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "fastmatch.h" #include "grep.h" static int linesqueued; @@ -309,17 +308,8 @@ procline(struct str *l, int nottext) } /* Loop to compare with all the patterns */ for (i = 0; i < patterns; i++) { -/* - * XXX: grep_search() is a workaround for speed up and should be - * removed in the future. See fastgrep.c. - */ - if (fg_pattern[i].pattern) - r = grep_search(&fg_pattern[i], - (unsigned char *)l->dat, - l->len, &pmatch); - else - r = regexec(&r_pattern[i], l->dat, 1, - &pmatch, eflags); + r = regexec(&r_pattern[i], l->dat, 1, + &pmatch, eflags); r = (r == 0) ? 0 : REG_NOMATCH; st = (cflags & REG_NOSUB) ? (size_t)l->len @@ -331,24 +321,6 @@ procline(struct str *l, int nottext) if (pmatch.rm_so != 0 || (size_t)pmatch.rm_eo != l->len) r = REG_NOMATCH; - /* Check for whole word match */ - if (r == 0 && (wflag || fg_pattern[i].word)) { - wint_t wbegin, wend; - - wbegin = wend = L' '; - if (pmatch.rm_so != 0 && - sscanf(&l->dat[pmatch.rm_so - 1], - "%lc", &wbegin) != 1) - r = REG_NOMATCH; - else if ((size_t)pmatch.rm_eo != - l->len && - sscanf(&l->dat[pmatch.rm_eo], - "%lc", &wend) != 1) - r = REG_NOMATCH; - else if (iswword(wbegin) || - iswword(wend)) - r = REG_NOMATCH; - } if (r == 0) { if (m == 0) c++;