Re: [PATCH v2] branch: colour upstream branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]