From fb7d7246f68844fc4062c081c8cab78a7a9320db Mon Sep 17 00:00:00 2001 From: gabor Date: Wed, 18 Aug 2010 17:40:10 +0000 Subject: - Refactor file reading code to use pure syscalls and an internal buffer instead of stdio. This gives BSD grep a very big performance boost, its speed is now almost comparable to GNU grep. Submitted by: Dimitry Andric Approved by: delphij (mentor) --- usr.bin/grep/grep.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'usr.bin/grep/grep.h') diff --git a/usr.bin/grep/grep.h b/usr.bin/grep/grep.h index 2f743e4..cf4443d 100644 --- a/usr.bin/grep/grep.h +++ b/usr.bin/grep/grep.h @@ -77,12 +77,8 @@ extern const char *errstr[]; #define MAX_LINE_MATCHES 32 struct file { - struct mmfile *mmf; - BZFILE *bzf; - FILE *f; - gzFile *gzf; + int fd; bool binary; - bool stdin; }; struct str { @@ -150,11 +146,10 @@ void clearqueue(void); /* file.c */ void grep_close(struct file *f); -struct file *grep_stdin_open(void); struct file *grep_open(const char *path); char *grep_fgetln(struct file *f, size_t *len); /* fastgrep.c */ int fastcomp(fastgrep_t *, const char *); void fgrepcomp(fastgrep_t *, const char *); -int grep_search(fastgrep_t *, unsigned char *, size_t, regmatch_t *); +int grep_search(fastgrep_t *, const unsigned char *, size_t, regmatch_t *); -- cgit v1.1