svn commit: r226432 - in user/gabor/tre-integration/usr.bin/grep: .
regex
Gabor Kovesdan
gabor at FreeBSD.org
Sun Oct 16 11:08:51 UTC 2011
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 <string.h>
#include <unistd.h>
-#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 <stdio.h>
#include <zlib.h>
-#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 <wchar.h>
#include <wctype.h>
-#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++;
More information about the svn-src-user
mailing list