Re: [RFC/PATCH] pager.c: replace git_config with git_config_get_string
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 28, 2014, 06:01 UTC
- Message-ID
- <vpqy4whshbj.fsf@anie.imag.fr>
- In-Reply-To
- <53AE50A9.6010707@gmail.com>
Karsten Blees <karsten.blees@gmail.com> writes:
> I still don't like that the invalidation is done in git_config_set, though, as > this is also used to write completely unrelated files.
I don't get it. It is used to write the config files. Yes, we trigger a complete reload instead of just changing this particular value in the hashmap, but I do not see "unrelated files" in the picture.
Show 5 quoted lines
> Wouldn't it be better to have a 'git_config_refresh()' that could be > used in place of (or before) current 'git_config(callback)' calls? The > initial implementation could just invalidate the config cache. If > there's time and energy to spare, a more advanced version could first > check if any of the involved config files has changed.
That would not change the "xstrdup" vs "no xstrdup" issue, right?
> The xstrdup() problem could be solved by interning strings (see the > attached patch for a trivial implementation). I.e. allocate each distinct > string only once (and keep it allocated).
That's an option. We need to be carefull not to modify any string in-place, but I guess that would considerably simplify memory management for strings.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/