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

Re: [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2012, 17:20 UTC
Message-ID
<7vy5s8j7d4.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAMocUqRutwERQ64a=9t36Za6Lm8KxpseS0NYbdGKWbixbsXeyw@mail.gmail.com>
徐迪 <xudifsd@gmail.com> writes:
> -/* Eventually this should go to strbuf.[ch] */
> -static int strbuf_readline_fd(struct strbuf *sb, int fd)
> -{

Unlike other line-oriented input functions in strbuf.c, this hardcodes the LF as the terminator, hence is not capable of reading -z output. As an internal function to the bundle reader implementation, that is perfectly fine, because we know lines in bundle ends with '\n'.

But if we were to promote this to a generic API, that aspect of this function needs to be reconsidered, and if we decide to allow non-LF line terminator for consistency with other functions, the current callers in this function have to pass an extra parameter "term" to it.

We simply do not have enough datapoint to see if it is worth it to promote this to strbuf.c with such a change, especially when there is no other caller to it. That is why we said "Eventually" here when we introduced this function at e9ee84c (bundle: allowing to read from an unseekable fd, 2011-10-13).

I do not think the situation changed yet in any way since then.
Previous: 徐迪
Message 5 of 5 in “strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}”
  1. strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}徐迪, Feb 11, 2012
  2. 徐迪Feb 12, 2012
  3. Junio C HamanoFeb 12, 2012
  4. 徐迪Feb 13, 2012
  5. Junio C HamanoFeb 12, 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.