diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-10-14 15:15:56 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-17 11:52:23 -0700 |
commit | ee624c0d3ff54e86a44cddf1d4ea6278b7a4f65c (patch) | |
tree | f6d46230443b565597d9ebb19be43ec4181d861f /builtin | |
parent | a23ca1b8dc42ffd4de2ef30d67ce1e21ded29886 (diff) | |
download | git-ee624c0d3ff54e86a44cddf1d4ea6278b7a4f65c.tar.gz git-ee624c0d3ff54e86a44cddf1d4ea6278b7a4f65c.tar.xz |
sequencer: use static initializers for replay_opts
This change is not completely faithful: instead of initializing all fields
to 0, we choose to initialize command and subcommand to -1 (instead of
defaulting to REPLAY_REVERT and REPLAY_NONE, respectively). Practically,
it makes no difference at all, but future-proofs the code to require
explicit assignments for both fields.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/revert.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index 4e693808b..7365559c9 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -178,10 +178,9 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) int cmd_revert(int argc, const char **argv, const char *prefix) { - struct replay_opts opts; + struct replay_opts opts = REPLAY_OPTS_INIT; int res; - memset(&opts, 0, sizeof(opts)); if (isatty(0)) opts.edit = 1; opts.action = REPLAY_REVERT; @@ -195,10 +194,9 @@ int cmd_revert(int argc, const char **argv, const char *prefix) int cmd_cherry_pick(int argc, const char **argv, const char *prefix) { - struct replay_opts opts; + struct replay_opts opts = REPLAY_OPTS_INIT; int res; - memset(&opts, 0, sizeof(opts)); opts.action = REPLAY_PICK; git_config(git_default_config, NULL); parse_args(argc, argv, &opts); |