builtin/apply: remove whitespace_option arg from set_default_whitespace_mode()
authorChristian Couder <christian.couder@gmail.com>
Tue, 24 May 2016 08:11:14 +0000 (10:11 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Jun 2016 17:10:16 +0000 (10:10 -0700)
A previous change has move the whitespace_option variable from cmd_apply
into 'struct apply_state', so that we can now avoid passing it separately
to set_default_whitespace_mode().

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c
index 78205f80536b7c658d216f1b439e0f8fffaf445c..523ed74a6cb5ddf05b6438cb246e85235a53d651 100644 (file)
@@ -132,10 +132,9 @@ static void parse_ignorewhitespace_option(const char *option)
        die(_("unrecognized whitespace ignore option '%s'"), option);
 }
 
-static void set_default_whitespace_mode(struct apply_state *state,
-                                       const char *whitespace_option)
+static void set_default_whitespace_mode(struct apply_state *state)
 {
-       if (!whitespace_option && !apply_default_whitespace)
+       if (!state->whitespace_option && !apply_default_whitespace)
                ws_error_action = (state->apply ? warn_on_ws_error : nowarn_ws_error);
 }
 
@@ -4785,11 +4784,11 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
                if (fd < 0)
                        die_errno(_("can't open patch '%s'"), arg);
                read_stdin = 0;
-               set_default_whitespace_mode(&state, state.whitespace_option);
+               set_default_whitespace_mode(&state);
                errs |= apply_patch(&state, fd, arg, options);
                close(fd);
        }
-       set_default_whitespace_mode(&state, state.whitespace_option);
+       set_default_whitespace_mode(&state);
        if (read_stdin)
                errs |= apply_patch(&state, 0, "<stdin>", options);
        if (state.whitespace_error) {