From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: What's cooking in git.git (Jan 2016, #02; Mon, 11)
Date: Wed, 13 Jan 2016 15:44:29 -0800 [thread overview]
Message-ID: <xmqqpox5kpsy.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160113232255.GA17937@sigill.intra.peff.net> (Jeff King's message of "Wed, 13 Jan 2016 18:22:56 -0500")
Jeff King <peff@peff.net> writes:
> I think you'll end up with some of the callers being a bit uglier. I.e.,
> where we say:
>
> strbuf_getline(&buf, in, delim);
>
> and "delim" is set elsewhere. These will become:
>
> if (delim == '\n') /* or maybe even "if (nul_terminate)" */
> strbuf_getline_lf(&buf, in);
> else
> strbuf_getline_nul(&buf, in);
My plan is to use a function pointer to switch between them. A code
like the above in practice look more like
(1) there is a config/option parser that sets line_terminator that
is typically a file-scope global.
if (z_option)
line_terminator = '\0';
else
line_terminator = '\n';
(2) the callsite calls getline with it
strbuf_getline(..., line_terminator);
So we can introduce a file-scope global, (*getline_fn)(), and then
tweak (1) by removing line_terminator and replacing the assignment
with an assignment to getline_fn.
next prev parent reply other threads:[~2016-01-13 23:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 23:45 What's cooking in git.git (Jan 2016, #02; Mon, 11) Junio C Hamano
2016-01-12 0:06 ` Mike Hommey
2016-01-12 3:04 ` Junio C Hamano
2016-01-12 4:34 ` Edmundo Carmona Antoranz
2016-01-12 8:39 ` Johannes Schindelin
2016-01-12 18:47 ` Junio C Hamano
2016-01-12 21:49 ` Jeff King
2016-01-13 23:07 ` Junio C Hamano
2016-01-13 23:22 ` Jeff King
2016-01-13 23:44 ` Junio C Hamano [this message]
2016-01-13 23:54 ` Junio C Hamano
2016-01-14 10:21 ` Jeff King
2016-01-13 2:56 ` David A. Greene
2016-01-18 13:35 ` Michael J Gruber
2016-01-18 17:06 ` Jeff King
2016-01-18 21:39 ` Eric Wong
2016-01-19 7:07 ` Michael J Gruber
2016-01-25 9:56 ` Duy Nguyen
2016-01-25 22:03 ` Junio C Hamano
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=xmqqpox5kpsy.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.