[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: fast getline for busybox (proof of concept, untested)
From: Rich Felker <dalias () aerifal ! cx>
Date: 2006-05-31 21:20:43
Message-ID: 20060531212043.GQ32494 () brightrain ! aerifal ! cx
[Download RAW message or body]
On Wed, May 31, 2006 at 04:55:46PM -0400, Rich Felker wrote:
> size_t fgets_embedded_nul(char *s, size_t n, FILE *f)
> {
> char *p, *z;
> memset(s, 1, n);
> if (!fgets(s, n, f)) return 0;
> for (p=s; z = memchr(p, 0, n); n -= ++z-p, p=z);
> return p-s-1;
> }
I have a much better version of this I'll write up and send later
(tonite?) when I have time. It will eliminate a significant portion of
the performance hit beyond 'normal' fgets.
Rich
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic