git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Aug 30, 2012, 17:25 UTC
Message-ID
<503FA216.8070704@ramsay1.demon.co.uk>
In-Reply-To
<7v3939wofb.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 24 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes:
> 
>> On Sat, Aug 25, 2012 at 7:13 PM, Ramsay Jones
>> <ramsay@ramsay1.demon.co.uk> wrote:
>>>
>>> The getline() function is a GNU extension (you need to define
>>> _GNU_SOURCE before including stdio.h) and is, therefore, not
>>> portable. In particular, getline() is not available on MinGW.
>>
>> Actually, getline is a POSIX-2008 feature, so it's not (simply) a GNU extension:
>>
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/getline.html
> 
> True, thanks for pointing it out.  Justify the change with something
> like this instead, perhaps?
> 
> 	The getline() function, even though is in POSIX.1-2008, is
> 	not available on some platforms.  Use strbuf_getline() for
> 	portability.
> 
> By the way, the remainder of the proposed log message talks about
> the difference between getline() that keeps the terminating LF vs
> strbuf_getline() that drops it.  Would strbuf_getwholeline() be a
> better alternative?

I don't think it matters; I was just making sure Florian was aware of the difference (it will not appear in the commit message anyway), including the memory leak in the original code.

ATB, Ramsay Jones

Previous: Junio C HamanoNext: Ramsay Jones
Message 5 of 6 in “remote-testsvn.c: Avoid the getline() GNU extension function”
  1. 1/3 remote-testsvn.c: Avoid the getline() GNU extension functionRamsay Jones, Aug 25, 2012
  2. Joachim SchmitzAug 25, 2012
  3. Erik Faye-LundAug 25, 2012
  4. Junio C HamanoAug 26, 2012
  5. Ramsay JonesAug 30, 2012
  6. Ramsay JonesAug 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.