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

2014-07-23 Thread Junio C Hamano
Matthieu Moy writes: > Junio C Hamano 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

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

2014-07-23 Thread Matthieu Moy
Junio C Hamano 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 sid

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

2014-07-22 Thread Junio C Hamano
Jeff King writes: > So I would not mind lifting this unnecessary restriction on > git_config_string, but I do not see a way to do it without making the > rest of the code much uglier (and I do not see a particular advantage in > modifying git_config_string here that would make it worth the troubl

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

2014-07-22 Thread Matthieu Moy
Junio C Hamano writes: > Matthieu Moy 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 ne

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

2014-07-22 Thread Junio C Hamano
Matthieu Moy 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 existin

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

2014-07-22 Thread Tanay Abhra
On 7/22/2014 5:14 PM, Matthieu Moy wrote: > Jeff King writes: > >> will complain that we are passing a pointer to "const char *", not a >> pointer to "char *". And indeed, compiling with your patch introduces a >> ton of compiler warnings. > > Tanay: are you not compiling with gcc -Wall -Werro

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

2014-07-22 Thread Matthieu Moy
Jeff King writes: > will complain that we are passing a pointer to "const char *", not a > pointer to "char *". And indeed, compiling with your patch introduces a > ton of compiler warnings. Tanay: are you not compiling with gcc -Wall -Werror? (see my earlier message, just create a file config.

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

2014-07-22 Thread Tanay Abhra
On 7/22/2014 4:37 PM, Jeff King wrote: > On Tue, Jul 22, 2014 at 03:49:56AM -0700, Tanay Abhra wrote: > >> `git_config_string()` output parameter `dest` is declared as a const >> which is unnecessary as the caller of the function is given a strduped >> string which can be modified without causin

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

2014-07-22 Thread Jeff King
On Tue, Jul 22, 2014 at 03:49:56AM -0700, Tanay Abhra wrote: > `git_config_string()` output parameter `dest` is declared as a const > which is unnecessary as the caller of the function is given a strduped > string which can be modified without causing any harm. > > Thus, remove the const from the

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

2014-07-22 Thread Tanay Abhra
`git_config_string()` output parameter `dest` is declared as a const which is unnecessary as the caller of the function is given a strduped string which can be modified without causing any harm. Thus, remove the const from the function signature. Signed-off-by: Tanay Abhra --- cache.h | 2 +-