summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-04 10:24:50 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-04 10:24:50 -0800
commit099ba556d05571001293c8eda10a4fc659f83f48 (patch)
treea7eb1760f82fdd9f769ea6a64e6ece7198ef471c /builtin/help.c
parent149a4211a4b8d8bbcdd72685d538d6ac7365e29e (diff)
parentb3873c336cc2eb5a6eb2b10981a2ca0b65b8c987 (diff)
downloadgit-099ba556d05571001293c8eda10a4fc659f83f48.tar.gz
Merge branch 'jk/config-parsing-cleanup'
Configuration parsing for tar.* configuration variables were broken. Introduce a new config-keyname parser API to make the callers much less error prone. * jk/config-parsing-cleanup: reflog: use parse_config_key in config callback help: use parse_config_key for man config submodule: simplify memory handling in config parsing submodule: use parse_config_key when parsing config userdiff: drop parse_driver function convert some config callbacks to parse_config_key archive-tar: use parse_config_key when parsing config config: add helper function for parsing key names
Diffstat (limited to 'builtin/help.c')
-rw-r--r--builtin/help.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin/help.c b/builtin/help.c
index 6067a6134b..d1d71816a9 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -236,21 +236,21 @@ static int add_man_viewer_cmd(const char *name,
static int add_man_viewer_info(const char *var, const char *value)
{
- const char *name = var + 4;
- const char *subkey = strrchr(name, '.');
+ const char *name, *subkey;
+ int namelen;
- if (!subkey)
+ if (parse_config_key(var, "man", &name, &namelen, &subkey) < 0 || !name)
return 0;
- if (!strcmp(subkey, ".path")) {
+ if (!strcmp(subkey, "path")) {
if (!value)
return config_error_nonbool(var);
- return add_man_viewer_path(name, subkey - name, value);
+ return add_man_viewer_path(name, namelen, value);
}
- if (!strcmp(subkey, ".cmd")) {
+ if (!strcmp(subkey, "cmd")) {
if (!value)
return config_error_nonbool(var);
- return add_man_viewer_cmd(name, subkey - name, value);
+ return add_man_viewer_cmd(name, namelen, value);
}
return 0;