Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: 徐迪 <xudifsd@gmail.com>
Cc: "Git 邮件列表" <git@vger.kernel.org>
Subject: Re: [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h}
Date: Sun, 12 Feb 2012 09:20:55 -0800	[thread overview]
Message-ID: <7vy5s8j7d4.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAMocUqRutwERQ64a=9t36Za6Lm8KxpseS0NYbdGKWbixbsXeyw@mail.gmail.com> ("徐迪"'s message of "Sat, 11 Feb 2012 17:50:37 +0800")

徐迪 <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.

      parent reply	other threads:[~2012-02-12 17:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-11  9:50 [PATCH] strbuf: move strbuf_readline_fd() from bundle.c to strbuf.{c,h} 徐迪
2012-02-12 12:25 ` 徐迪
2012-02-12 17:07   ` Junio C Hamano
2012-02-13  3:54     ` 徐迪
2012-02-12 17:20 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vy5s8j7d4.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=xudifsd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox