summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 21:07:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-25 17:18:18 (GMT)
commitacd47eec992160d76d5d4a2e98940de3fdc10552 (patch)
treeccab4f6f9afb20bb31d089eec7394b39e1a5fae5 /builtin/help.c
parenta5e03bf5c686e9f2da5e94e091e0ea531d40c6b8 (diff)
downloadgit-acd47eec992160d76d5d4a2e98940de3fdc10552.zip
git-acd47eec992160d76d5d4a2e98940de3fdc10552.tar.gz
git-acd47eec992160d76d5d4a2e98940de3fdc10552.tar.bz2
help: drop prepend function in favor of xstrfmt
This function predates xstrfmt, and its functionality is a subset. Let's just use xstrfmt. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/help.c')
-rw-r--r--builtin/help.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/builtin/help.c b/builtin/help.c
index 3422e73..fba8c01 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -295,16 +295,6 @@ static int is_git_command(const char *s)
is_in_cmdlist(&other_cmds, s);
}
-static const char *prepend(const char *prefix, const char *cmd)
-{
- size_t pre_len = strlen(prefix);
- size_t cmd_len = strlen(cmd);
- char *p = xmalloc(pre_len + cmd_len + 1);
- memcpy(p, prefix, pre_len);
- strcpy(p + pre_len, cmd);
- return p;
-}
-
static const char *cmd_to_page(const char *git_cmd)
{
if (!git_cmd)
@@ -312,9 +302,9 @@ static const char *cmd_to_page(const char *git_cmd)
else if (starts_with(git_cmd, "git"))
return git_cmd;
else if (is_git_command(git_cmd))
- return prepend("git-", git_cmd);
+ return xstrfmt("git-%s", git_cmd);
else
- return prepend("git", git_cmd);
+ return xstrfmt("git%s", git_cmd);
}
static void setup_man_path(void)