Re: [RFC/PATCH] imap-send.c: replace git_config with git_config_get_string
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 26, 2014, 16:50 UTC
- Message-ID
- <vpqbntfmx81.fsf@anie.imag.fr>
- In-Reply-To
- <1403520105-23250-3-git-send-email-tanayabh@gmail.com>
Tanay Abhra <tanayabh@gmail.com> writes:
Show 10 quoted lines
> + if (!git_config_get_string("imap.user", &value))
> + server.user = xstrdup(value);
> + if (!git_config_get_string("imap.pass", &value))
> + server.pass = xstrdup(value);
> + if (!git_config_get_string("imap.port", &value))
> + server.port = git_config_int("port", value);
> + if (!git_config_get_string("imap.tunnel", &value))
> + server.tunnel = xstrdup(value);
> + if (!git_config_get_string("imap.authmethod", &value))
> + server.auth_method = xstrdup(value);Given this kind of systematic code, I find it very tempting to factor this with a new helper function as
... git_config_get_string_dup("imap.tunnel", &server.tunnel) git_config_get_string_dup("imap.authmethod", &server.auth_method)
Is there any reason not to do so?
-- Matthieu Moy http://www-verimag.imag.fr/~moy/