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

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/
Previous: Tanay AbhraNext: Karsten Blees
Message 9 of 41 in “alias.c: replace git_config with git_config_get_string”
  1. alias.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  2. branch.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  3. Eric SunshineJun 25, 2014
  4. Tanay AbhraJun 26, 2014
  5. Eric SunshineJun 29, 2014
  6. imap-send.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  7. Eric SunshineJun 25, 2014
  8. Tanay AbhraJun 26, 2014
  9. Matthieu MoyJun 26, 2014
  10. Karsten BleesJun 26, 2014
  11. notes-util.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  12. Eric SunshineJun 25, 2014
  13. Tanay AbhraJun 26, 2014
  14. Eric SunshineJun 29, 2014
  15. Karsten BleesJun 30, 2014
  16. Eric SunshineJun 30, 2014
  17. Karsten BleesJun 30, 2014
  18. Tanay AbhraJun 30, 2014
  19. Karsten BleesJun 30, 2014
  20. Tanay AbhraJun 30, 2014
  21. Junio C HamanoJun 30, 2014
  22. Matthieu MoyJul 1, 2014
  23. notes.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  24. Eric SunshineJun 25, 2014
  25. Tanay AbhraJun 26, 2014
  26. pager.c: replace git_config with git_config_get_stringTanay Abhra, Jun 23, 2014
  27. Eric SunshineJun 25, 2014
  28. Tanay AbhraJun 26, 2014
  29. Karsten BleesJun 26, 2014
  30. Matthieu MoyJun 27, 2014
  31. Karsten BleesJun 27, 2014
  32. Matthieu MoyJun 27, 2014
  33. Karsten BleesJun 28, 2014
  34. Matthieu MoyJun 28, 2014
  35. Karsten BleesJun 28, 2014
  36. Matthieu MoyJun 29, 2014
  37. Jonathan NiederJun 23, 2014
  38. Tanay AbhraJun 24, 2014
  39. Eric SunshineJun 25, 2014
  40. Tanay AbhraJun 26, 2014
  41. Matthieu MoyJun 26, 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.