{"thread":{"id":"37140","subject":"[PATCH] run-command: use internal argv_array of struct child_process in run_hook_ve()","startedAt":"2014-07-16T21:57:47Z","lastAt":"2014-07-17T21:32:40Z","messageCount":2,"participants":["René Scharfe","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"246189","messageId":"53C6F55B.9000404@web.de","threadId":"37140","inReplyTo":null,"subject":"[PATCH] run-command: use internal argv_array of struct child_process in run_hook_ve()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-07-16T21:57:47Z","receivedAt":"2014-07-16T21:57:47Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Use the existing argv_array member instead of providing our own.  This\nway we don't have to initialize or clean it up explicitly.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n run-command.c | 15 ++++-----------\n 1 file changed, 4 insertions(+), 11 deletions(-)\n\ndiff --git a/run-command.c b/run-command.c\nindex be07d4a..576dfea 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -770,28 +770,21 @@ char *find_hook(const char *name)\n int run_hook_ve(const char *const *env, const char *name, va_list args)\n {\n \tstruct child_process hook;\n-\tstruct argv_array argv = ARGV_ARRAY_INIT;\n \tconst char *p;\n-\tint ret;\n \n \tp = find_hook(name);\n \tif (!p)\n \t\treturn 0;\n \n-\targv_array_push(&argv, p);\n-\n-\twhile ((p = va_arg(args, const char *)))\n-\t\targv_array_push(&argv, p);\n-\n \tmemset(&hook, 0, sizeof(hook));\n-\thook.argv = argv.argv;\n+\targv_array_push(&hook.args, p);\n+\twhile ((p = va_arg(args, const char *)))\n+\t\targv_array_push(&hook.args, p);\n \thook.env = env;\n \thook.no_stdin = 1;\n \thook.stdout_to_stderr = 1;\n \n-\tret = run_command(&hook);\n-\targv_array_clear(&argv);\n-\treturn ret;\n+\treturn run_command(&hook);\n }\n \n int run_hook_le(const char *const *env, const char *name, ...)\n-- \n2.0.0\n"},{"id":"246274","messageId":"20140717213239.GC2622@peff.net","threadId":"37140","inReplyTo":"53C6F55B.9000404@web.de","subject":"Re: [PATCH] run-command: use internal argv_array of struct child_process in run_hook_ve()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-07-17T21:32:40Z","receivedAt":"2014-07-17T21:32:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 16, 2014 at 11:57:47PM +0200, René Scharfe wrote:\n\n> Use the existing argv_array member instead of providing our own.  This\n> way we don't have to initialize or clean it up explicitly.\n\nYay. Thanks for this cleanup (and all of the other recent ones; they all\nlooked good to me).\n\n-Peff\n"}]}