Git development
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Tanay Abhra <tanayabh@gmail.com>,
	git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH] config.c: change the function signature of `git_config_string()`
Date: Tue, 22 Jul 2014 18:03:07 +0200	[thread overview]
Message-ID: <vpqsiltfkjo.fsf@anie.imag.fr> (raw)
In-Reply-To: <xmqqoawhgzky.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Tue, 22 Jul 2014 08:53:01 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> OK, it seems I got convinced too quickly by Junio ;-). The function
>> produces a char * that can be modified, but it also receives a value,
>> and the function should keep the "const" to allow passing "const char
>> *".
>
> Don't blame me. I never suggested to touch that existing function,
> with existing call sites.

I don't understand what you mean. The new git_config_get_string()
function is meant to be used in essentially every places where
git_config_string() is currently used, so removing the const from
git_config_get_string() raises the same issue as changing the existing
function.

Dropping the const means we won't be able to write

const char *v = "default";
...
git_config_get_string(&v, ...);

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2014-07-22 16:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 10:49 [PATCH] config.c: change the function signature of `git_config_string()` Tanay Abhra
2014-07-22 11:07 ` Jeff King
2014-07-22 11:41   ` Tanay Abhra
2014-07-22 11:44   ` Matthieu Moy
2014-07-22 11:48     ` Tanay Abhra
2014-07-22 15:53     ` Junio C Hamano
2014-07-22 16:03       ` Matthieu Moy [this message]
2014-07-22 16:47   ` Junio C Hamano
2014-07-23  8:42     ` Matthieu Moy
2014-07-23 17:25       ` Junio C Hamano

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=vpqsiltfkjo.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=tanayabh@gmail.com \
    /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