{"thread":{"id":"40075","subject":"[PATCH] run-command: Improve readability of struct child_process","startedAt":"2015-08-12T21:50:26Z","lastAt":"2015-08-12T21:50:26Z","messageCount":1,"participants":["Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"267950","messageId":"1439416226-20749-1-git-send-email-sbeller@google.com","threadId":"40075","inReplyTo":null,"subject":"[PATCH] run-command: Improve readability of struct child_process","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-08-12T21:50:26Z","receivedAt":"2015-08-12T21:50:26Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Reordering the struct member env to be next to env_array\nhelps understanding the struct better.\n\nThis also adds comments to indicate that arg{s,v} and (env, env_array)\nare used for the same purpose and only one must be used. Although\nthese comments are in the Documentation, I still think they are\na good idea in the code here as well.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n run-command.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/run-command.h b/run-command.h\nindex 1103805..e67395d 100644\n--- a/run-command.h\n+++ b/run-command.h\n@@ -8,8 +8,9 @@\n #include \"argv-array.h\"\n \n struct child_process {\n-\tconst char **argv;\n+\tconst char **argv; /* Use only one of arg{v,s} */\n \tstruct argv_array args;\n+\tconst char *const *env; /* Use only one of (env, env_array) */\n \tstruct argv_array env_array;\n \tpid_t pid;\n \t/*\n@@ -34,7 +35,6 @@ struct child_process {\n \tint out;\n \tint err;\n \tconst char *dir;\n-\tconst char *const *env;\n \tunsigned no_stdin:1;\n \tunsigned no_stdout:1;\n \tunsigned no_stderr:1;\n@@ -45,7 +45,7 @@ struct child_process {\n \tunsigned clean_on_exit:1;\n };\n \n-#define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, ARGV_ARRAY_INIT }\n+#define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, NULL, ARGV_ARRAY_INIT }\n void child_process_init(struct child_process *);\n \n int start_command(struct child_process *);\n-- \n2.5.0.234.gefc8a62\n"}]}