Date: Fri, 4 May 2018 03:13:26 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333236 - in head: share/mk tools/build/options usr.bin/grep usr.bin/grep/regex Message-ID: <201805040313.w443DQpP004804@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Fri May 4 03:13:25 2018 New Revision: 333236 URL: https://svnweb.freebsd.org/changeset/base/333236 Log: bsdgrep: annihilate our in-tree TRE, previously disabled by default It was an old TRE that had plenty of bugs and no performance gain over regex(3). I disabled it by default in r323615, and there was some confusion about what the knob does- likely due to poor naming on my part- to the tune of "well, it sounds like it should speed things up" (mentioned by multiple people). To compound this, I have no intention of maintaining a second regex implementation. If someone would like to step up and volunteer to maintain a lean-and-mean implementation for grep, this is OK, but we have very few volunteers to maintain even our primary regex implementation. Deleted: head/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH head/tools/build/options/WITH_BSD_GREP_FASTMATCH head/usr.bin/grep/regex/ Modified: head/share/mk/bsd.prog.mk head/share/mk/src.opts.mk head/usr.bin/grep/Makefile head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri May 4 01:36:49 2018 (r333235) +++ head/share/mk/bsd.prog.mk Fri May 4 03:13:25 2018 (r333236) @@ -271,6 +271,7 @@ SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} STAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} _scriptsinstall: _SCRIPTSINS_${script:T} + echo ">SFD>F>DF YES" _SCRIPTSINS_${script:T}: ${script} ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri May 4 01:36:49 2018 (r333235) +++ head/share/mk/src.opts.mk Fri May 4 03:13:25 2018 (r333236) @@ -187,7 +187,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BSD_GREP \ - BSD_GREP_FASTMATCH \ CLANG_EXTRAS \ DTRACE_TESTS \ GNU_GREP_COMPAT \ Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/Makefile Fri May 4 03:13:25 2018 (r333236) @@ -17,15 +17,6 @@ bsdgrep.1: grep.1 .endif SRCS= file.c grep.c queue.c util.c -.if ${MK_BSD_GREP_FASTMATCH} == "yes" -# Extra files ported backported for some regex improvements -.PATH: ${.CURDIR}/regex -SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c -CFLAGS+=-I${.CURDIR}/regex -.else -CFLAGS+= -DWITHOUT_FASTMATCH -.endif - SCRIPTS= zgrep.sh LINKS= ${BINDIR}/zgrep ${BINDIR}/zfgrep \ ${BINDIR}/zgrep ${BINDIR}/zegrep \ Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/grep.c Fri May 4 03:13:25 2018 (r333236) @@ -51,9 +51,6 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif #include "grep.h" #ifndef WITHOUT_NLS @@ -96,9 +93,6 @@ unsigned int patterns; static unsigned int pattern_sz; struct pat *pattern; regex_t *r_pattern; -#ifndef WITHOUT_FASTMATCH -fastmatch_t *fg_pattern; -#endif /* Filename exclusion/inclusion patterns */ unsigned int fpatterns, dpatterns; @@ -712,9 +706,6 @@ main(int argc, char *argv[]) usage(); } -#ifndef WITHOUT_FASTMATCH - fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern)); -#endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Don't process any patterns if we have a blank one */ @@ -725,15 +716,6 @@ main(int argc, char *argv[]) #endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { -#ifndef WITHOUT_FASTMATCH - /* - * Attempt compilation with fastmatch regex and - * fallback to regex(3) if it fails. - */ - if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) == 0) - continue; -#endif c = regcomp(&r_pattern[i], pattern[i].pat, cflags); if (c != 0) { regerror(c, &r_pattern[i], re_error, Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/grep.h Fri May 4 03:13:25 2018 (r333236) @@ -38,10 +38,6 @@ #include <stdio.h> #include <zlib.h> -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif - #ifdef WITHOUT_NLS #define getstr(n) errstr[n] #else @@ -131,9 +127,6 @@ extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; extern regex_t *er_pattern, *r_pattern; -#ifndef WITHOUT_FASTMATCH -extern fastmatch_t *fg_pattern; -#endif /* For regex errors */ #define RE_ERROR_BUF 512 Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/util.c Fri May 4 03:13:25 2018 (r333236) @@ -52,9 +52,6 @@ __FBSDID("$FreeBSD$"); #include <wchar.h> #include <wctype.h> -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif #include "grep.h" static bool first_match = true; @@ -512,14 +509,8 @@ procline(struct parsec *pc) r = litexec(&pattern[i], pc->ln.dat, 1, &pmatch); else #endif -#ifndef WITHOUT_FASTMATCH - if (fg_pattern[i].pattern) - r = fastexec(&fg_pattern[i], - pc->ln.dat, 1, &pmatch, leflags); - else -#endif - r = regexec(&r_pattern[i], pc->ln.dat, 1, - &pmatch, leflags); + r = regexec(&r_pattern[i], pc->ln.dat, 1, &pmatch, + leflags); if (r != 0) continue; /* Check for full match */ @@ -527,11 +518,7 @@ procline(struct parsec *pc) (size_t)pmatch.rm_eo != pc->ln.len)) continue; /* Check for whole word match */ -#ifndef WITHOUT_FASTMATCH - if (wflag || fg_pattern[i].word) { -#else if (wflag) { -#endif wbegin = wend = L' '; if (pmatch.rm_so != 0 && sscanf(&pc->ln.dat[pmatch.rm_so - 1],
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805040313.w443DQpP004804>