git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] config.c: change the function signature of `git_config_string()`

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jul 22, 2014, 16:03 UTC
Message-ID
<vpqsiltfkjo.fsf@anie.imag.fr>
In-Reply-To
<xmqqoawhgzky.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> 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/
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 10 in “config.c: change the function signature of `git_config_string()`”
  1. config.c: change the function signature of `git_config_string()`Tanay Abhra, Jul 22, 2014
  2. Jeff KingJul 22, 2014
  3. Tanay AbhraJul 22, 2014
  4. Matthieu MoyJul 22, 2014
  5. Tanay AbhraJul 22, 2014
  6. Junio C HamanoJul 22, 2014
  7. Matthieu MoyJul 22, 2014
  8. Junio C HamanoJul 22, 2014
  9. Matthieu MoyJul 23, 2014
  10. Junio C HamanoJul 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.