Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Aug 2010 12:42:49 +0200
From:      Dimitry Andric <dimitry@andric.com>
To:        =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= <des@des.no>
Cc:        Doug Barton <dougb@FreeBSD.org>, Justin Hibbits <chmeeedalf@gmail.com>, core@freebsd.org, delphij@freebsd.org, Gabor Kovesdan <gabor@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, current@freebsd.org
Subject:   Re: Official request: Please make GNU grep the default
Message-ID:  <4C691629.4010006@andric.com>
In-Reply-To: <4C6844D8.5070602@andric.com>
References:  <4C6505A4.9060203@FreeBSD.org>	<20100813085235.GA16268@freebsd.org>	<4C66C010.3040308@FreeBSD.org>	<4C673F02.8000805@FreeBSD.org>	<20100815013438.GA8958@troutmask.apl.washington.edu>	<4C67492C.5020206@FreeBSD.org>	<B7A05068-9578-4341-851B-86BD9BC7A2DA@gmail.com>	<8639ufd78w.fsf@ds4.des.no> <4C6844D8.5070602@andric.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030707040809090904070205
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 2010-08-15 21:49, Dimitry Andric wrote:
> ...I
> have attached a more complete patch that:
> 
> - Replaces the horrendously inefficient grep_fgetln() with mostly the
>   same implementation as the libc fgetln() function.
> - Uses plain file descriptors instead of struct FILE, since the
>   buffering is done manually anyway, and it makes it easier to support
>   gzip and bzip2.
> - Let the bzip2 reader just read the file as plain data, when the
>   initial magic number doesn't match, mimicking the behaviour of GNU
>   grep.

Here is a new patch, updated against Gabor's changes in r211364.

--------------030707040809090904070205
Content-Type: text/plain;
 name="bsdgrep-speed-2.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="bsdgrep-speed-2.diff"

ZGlmZiAtLWdpdCBhL3Vzci5iaW4vZ3JlcC9mYXN0Z3JlcC5jIGIvdXNyLmJpbi9ncmVwL2Zh
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3JlcC5jICovCiBpbnQJCSBmYXN0Y29tcChmYXN0Z3JlcF90ICosIGNvbnN0IGNo
YXIgKik7CiB2b2lkCQkgZmdyZXBjb21wKGZhc3RncmVwX3QgKiwgY29uc3QgY2hhciAqKTsK
LWludAkJIGdyZXBfc2VhcmNoKGZhc3RncmVwX3QgKiwgdW5zaWduZWQgY2hhciAqLCBzaXpl
X3QsIHJlZ21hdGNoX3QgKik7CitpbnQJCSBncmVwX3NlYXJjaChmYXN0Z3JlcF90ICosIGNv
bnN0IHVuc2lnbmVkIGNoYXIgKiwgc2l6ZV90LCByZWdtYXRjaF90ICopOwo=
--------------030707040809090904070205--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C691629.4010006>