bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: getline


From: Simon Josefsson
Subject: [bug-gnulib] Re: getline
Date: Tue, 28 Dec 2004 01:06:55 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Simon Josefsson <address@hidden> writes:
>
>> Are you saying getline/getdelim when built in glibc should not use
>> getndelim2, so they don't take any performance hit?
>
> Sorry, I hadn't thought it through.  But I was hoping it could be done
> without any performance hit, while still using getndelim2.  Perhaps
> with inline functions.  (Sorry, I'm pretty dense right now too....)

I'm not sure it is feasible, the glibc code for getline and getdelim
differ in several ways.  Unless one of the current implementations is
inefficient, I think that any merging might cause a performance hit in
glibc getline or getdelim.

>> Here's an idea.  Maybe the glibc getline/getdelim code could be
>> modified so they optionally (when 'HAVE_GETNDELIM2') uses getndelim2,
>> and then the gnulib modules for getline/getdelim is synced with the
>> glibc implementation?
>
> That would also work, but it would mean more duplicate code, no?
> getndelim2 essentially copies getdelim.

Yes.  And the glibc getline/getdelim would have to be modified
considerably to be usable inside gnulib (to allow for LGPL
getline/getdelim, without getndelim2), creating lots of #if's in code
that look clean right now.  So I don't like this approach.

I'm not sure what a good solution is.  It is difficult to patch the
current glibc getline/getdelim code into being usable as a gnulib
module, and doing so would also create code duplication in getndelim2.
Adding getndelim2 internally to glibc, and make getline/getdelim use
it, could work, but will likely create some slowdown.  Even so, the
getndelim2 implementation for glibc would need several #if's to be
usable in gnulib, unless the glibc version can use getc etc (which I
doubt).

Perhaps the glibc getline/getdelim code is simply too far away from
code that is usable in gnulib at this point.

I have a quickly ported getline/getdelim from glibc in lessergnulib:
<http://josefsson.org/cgi-bin/viewcvs.cgi/lessergnulib/lib/>. It has
not been tested, but that can be arranged.

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]