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
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2014, 17:25 UTC
Message-ID
<xmqqr41cdm1s.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqegxccvq9.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 8 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> *1* We have safe_create_leading_directories_const() that works
>> around this for input parameter around its _const less counterpart,
>> which is ugly but livable solution.
>
> I think it would actually be a reasonable solution to avoid casting here
> and there on the caller side.

"Ugly" primarily refers to the fact that we are forced to do this in the first place by the language. I agree with you, especially if we have very many call sites, and I suspect config-get-string actually would.

> Another option would be to _return_ a non-const char * instead of
> outputing it as a by-address parameter.
Here, too, I agree that it is the most C-ish interface.
Previous: Matthieu Moy
Message 10 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.