git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org, Junio Hamano <junkio@cox.net>,
	Pierre Habouzit <madcoder@debian.org>,
	Martin Koegler <mkoegler@auto.tuwien.ac.at>,
	Johannes Sixt <j.sixt@viscovery.net>
Subject: Re: [PATCH 2/6] config: add 'git_config_string' to refactor string config variables.
Date: Sat, 16 Feb 2008 06:53:10 -0500	[thread overview]
Message-ID: <20080216115310.GA11318@sigill.intra.peff.net> (raw)
In-Reply-To: <20080216060024.385fa360.chriscool@tuxfamily.org>

On Sat, Feb 16, 2008 at 06:00:24AM +0100, Christian Couder wrote:

> +int git_config_string(const char **dest, const char *var, const char *value)
> +{
> +	if (!value)
> +		return config_error_nonbool(var);
> +	*dest = xstrdup(value);
> +	return 0;
> +}

I'm not sure I see the point in using a 'const char *' as the
destination. The string isn't inherently const, since it is allocated on
the heap; callers are free to use it as they please (and are responsible
for freeing it; while constness doesn't impact calling free() at a
language level, I think that stylistically it is uncommon for a
heap-allocated string to be stored as 'const').

-Peff

  reply	other threads:[~2008-02-16 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16  5:00 [PATCH 2/6] config: add 'git_config_string' to refactor string config variables Christian Couder
2008-02-16 11:53 ` Jeff King [this message]
2008-02-16 18:21   ` Christian Couder
2008-02-16 18:33     ` 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=20080216115310.GA11318@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=junkio@cox.net \
    --cc=madcoder@debian.org \
    --cc=mkoegler@auto.tuwien.ac.at \
    /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).