From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH] run-command: Improve readability of struct child_process
Date: Wed, 12 Aug 2015 14:50:26 -0700 [thread overview]
Message-ID: <1439416226-20749-1-git-send-email-sbeller@google.com> (raw)
Reordering the struct member env to be next to env_array
helps understanding the struct better.
This also adds comments to indicate that arg{s,v} and (env, env_array)
are used for the same purpose and only one must be used. Although
these comments are in the Documentation, I still think they are
a good idea in the code here as well.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
run-command.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/run-command.h b/run-command.h
index 1103805..e67395d 100644
--- a/run-command.h
+++ b/run-command.h
@@ -8,8 +8,9 @@
#include "argv-array.h"
struct child_process {
- const char **argv;
+ const char **argv; /* Use only one of arg{v,s} */
struct argv_array args;
+ const char *const *env; /* Use only one of (env, env_array) */
struct argv_array env_array;
pid_t pid;
/*
@@ -34,7 +35,6 @@ struct child_process {
int out;
int err;
const char *dir;
- const char *const *env;
unsigned no_stdin:1;
unsigned no_stdout:1;
unsigned no_stderr:1;
@@ -45,7 +45,7 @@ struct child_process {
unsigned clean_on_exit:1;
};
-#define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, ARGV_ARRAY_INIT }
+#define CHILD_PROCESS_INIT { NULL, ARGV_ARRAY_INIT, NULL, ARGV_ARRAY_INIT }
void child_process_init(struct child_process *);
int start_command(struct child_process *);
--
2.5.0.234.gefc8a62
reply other threads:[~2015-08-12 21:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439416226-20749-1-git-send-email-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).