git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	git@vger.kernel.org, Thomas Rast <trast@inf.ethz.ch>,
	Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH v2] branch: colour upstream branches
Date: Sun, 14 Apr 2013 18:52:25 -0700	[thread overview]
Message-ID: <7vd2tw4l2e.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20130415004746.GA6477@sigill.intra.peff.net> (Jeff King's message of "Sun, 14 Apr 2013 20:47:46 -0400")

Jeff King <peff@peff.net> writes:

> On Sun, Apr 14, 2013 at 06:38:27PM -0500, Felipe Contreras wrote:
>
>> +		if (want_color(branch_use_color))
>> +			snprintf(fancy, sizeof(fancy), "%s%s%s",
>> +					branch_get_color(BRANCH_COLOR_UPSTREAM),
>> +					ref, branch_get_color(BRANCH_COLOR_RESET));
>> +		else
>> +			strncpy(fancy, ref, sizeof(fancy));
>
>   $ man strncpy | grep -C1 Warning
>   The strncpy() function is similar, except that at most n bytes of src are
>   copied.  Warning: If there is no null byte among the first n bytes of src,
>   the string placed in dest will not be null-terminated.

Is there a reason to avoid strbuf_addf() here?  We are talking about
output for human consumption and not performance critical code, no?

  reply	other threads:[~2013-04-15  1:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 23:38 [PATCH v2] branch: colour upstream branches Felipe Contreras
2013-04-15  0:47 ` Jeff King
2013-04-15  1:52   ` Junio C Hamano [this message]
2013-04-15  2:27     ` Felipe Contreras

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=7vd2tw4l2e.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=trast@inf.ethz.ch \
    /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;
as well as URLs for NNTP newsgroup(s).