Re: [PATCH] Move color option parsing out of diff.c and into color.[ch]

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

 



Jeff King <peff@xxxxxxxx> writes:

> +static int color_vprintf(const char *color, const char *fmt,
> +		va_list args, const char *trail)
> +{
> +	int r = 0;
> +
> +	if (*color)
> +		r += printf("%s", color);
> +	r += vprintf(fmt, args);
> +	if (trail)
> +		r += printf("%s", trail);
> +	if (*color)
> +		r += printf("%s", COLOR_RESET);
> +	return r;
> +}

Hmm,... don't you mean RESET first and then trail (which is often "\n")?

> +int color_printf(const char *color, const char *fmt, ...)
> +{
> +	va_list args;
> +	int r;
> +	va_start(args, fmt);
> +	r = color_vprintf(color, fmt, args, 0);
> +	va_end(args);
> +	return r;
> +}

Please spell NULL not 0 (please do not argue that writing a NULL
pointer as integral constant 0 is perfectly valid C -- we all
know that.  This is not the language-lawyers correctness issue,
but ../linux-2.6/Documentation/CodingStyle thing).  Using
pointer as boolean seems to be Ok style (e.g. "if (trail)" does
not have to be written "if (trail == NULL)").

-
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]