[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] Seekable parsers
From: |
Jose E. Marchesi |
Subject: |
Re: [bug-recutils] Seekable parsers |
Date: |
Thu, 24 May 2012 22:27:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
> That is ok. But since the special case where SOURCE is NULL-terminated
> can be easily handled using strlen (source) as the SIZE argument, I
> would not introduce a new function. Just rename rec_parser_new_str into
> rec_parser_new_mem.
Checking that seek positions fit in the buffer would also use the size,
so knowing it would be useful also with NULL-terminated buffers. This
change would also make less tests needed than adding a separate
backend.
Yes, it makes sense to turn rec_parser_new_str into rec_parser_new_mem.
> But then, is using mmap the best option here? An alternative would be
> to expand the fopen-based parser backend in order to use fseek/ftell.
> The FILE* functions have less portability issues that mmap, and the
> parser is character-oriented anyway.
Using mmap could be faster, this should be easy to measure later, so
I'll expand the file backend instead.
Ok.
--
Jose E. Marchesi http://www.jemarch.net
GNU Project http://www.gnu.org