Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
help: drop prepend function in favor of xstrfmt
author
Jeff King
<peff@peff.net>
Thu, 24 Sep 2015 21:07:14 +0000
(17:07 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 25 Sep 2015 17:18:18 +0000
(10:18 -0700)
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>
builtin/help.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a5e03bf
)
diff --git
a/builtin/help.c
b/builtin/help.c
index 3422e7307998b9da91f85512084aeae515022a60..fba8c01e242debd08dc450fa1ed4db587acfdb09 100644
(file)
--- 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);
}
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)
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))
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
else
- return
prepend("git
", git_cmd);
+ return
xstrfmt("git%s
", git_cmd);
}
static void setup_man_path(void)
}
static void setup_man_path(void)