Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] Move color option parsing out of diff.c and into color.[ch]
Date: Thu, 07 Sep 2006 16:56:43 -0700	[thread overview]
Message-ID: <7vfyf3s01w.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20060907063559.GB17083@coredump.intra.peff.net> (Jeff King's message of "Thu, 7 Sep 2006 02:35:59 -0400")

Jeff King <peff@peff.net> writes:

> +#include <stdarg.h>
> +
> +#define COLOR_RESET "\033[m"
> +
> +static int
> +parse_color(const char *name, int len)
> +{

Style (applies to all functions you moved to this new file).

Some school of programming teach us to start the function name
at the beginning of the line, separate from its type.  They say
that would make "grep '^parse_color'" to work better.

That happens to be the way I was taught (actually it was a bit
more strange that return type was to be indented by one TAB, so
it looked like this:

		static int
	parse_color(const char *name, int len)

).  But git style is the kernel style, and I refrain from doing
that myself.

	static int parse_color(const char *name, int len)
	{
        	...

> +int
> +git_config_colorbool(const char *var, const char *value)
> +{
> +	if (!value)
> +		return 1;
> +	if (!strcasecmp(value, "auto")) {
> +		if (isatty(1) || (pager_in_use && pager_use_color)) {
> +			char *term = getenv("TERM");
> +			if (term && strcmp(term, "dumb"))
> +				return 1;
> +		}
> +		return 0;
> +	}
> +	if (!strcasecmp(value, "never"))
> +		return 0;
> +	if (!strcasecmp(value, "always"))
> +		return 1;
> +	return git_config_bool(var, value);
> +}

> +int
> +color_printf(const char *color, const char *fmt, ...) {

Style.

	int color_printf(const char *color, const char *fmt, ...)
	{
		...

  reply	other threads:[~2006-09-07 23:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2ec783f6a8e8a901f7c30947e8c0eb50f71bc185.1157610743.git.peff@peff.net>
2006-09-07  6:35 ` [PATCH 2/3] Move color option parsing out of diff.c and into color.[ch] Jeff King
2006-09-07 23:56   ` Junio C Hamano [this message]
2006-09-08  0:11     ` Jeff King

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=7vfyf3s01w.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox