summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f64fe7b)
raw | patch | inline | side by side (parent: f64fe7b)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 25 Nov 2007 18:07:55 +0000 (10:07 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 25 Nov 2007 18:23:10 +0000 (10:23 -0800) |
The earlier 7c0ab4458994aa895855abc4a504cf693ecc0cf1 (Teach builtin-add
to pass multiple paths to git-add--interactive) did not allocate enough,
and had unneeded (void*) pointer arithmetic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
to pass multiple paths to git-add--interactive) did not allocate enough,
and had unneeded (void*) pointer arithmetic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-add.c | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index dd895dfb1d35f7e90d6529821e284d73e912d6d6..7c6a296af13b4245a701f8893cc00aa7f0a41277 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
int interactive_add(int argc, const char **argv)
{
int status;
- const char **args = xmalloc(sizeof(const char *) * (argc + 1));
+ const char **args = xcalloc(sizeof(const char *), (argc + 2));
+
args[0] = "add--interactive";
- memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc);
+ memcpy(&(args[1]), argv, sizeof(const char *) * argc);
args[argc + 1] = NULL;
status = run_command_v_opt(args, RUN_GIT_CMD);