diff options
author | Christian Couder <christian.couder@gmail.com> | 2016-05-24 10:11:10 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-01 10:10:16 -0700 |
commit | b76184e41003c6bd4731d79474c72449f854b37c (patch) | |
tree | 799c05b7df4b8c473208c1c148f7715459d01900 /builtin | |
parent | dbd23433e7b3d95bb03b44e9da86f713f1e35e17 (diff) | |
download | git-b76184e41003c6bd4731d79474c72449f854b37c.tar.gz git-b76184e41003c6bd4731d79474c72449f854b37c.tar.xz |
builtin/apply: move 'p_value_known' global into 'struct apply_state'
To libify the apply functionality the 'p_value_known' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/apply.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index 843fafd62..e1b68d4cb 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -52,6 +52,7 @@ struct apply_state { const char *patch_input_file; int line_termination; int p_value; + int p_value_known; unsigned int p_context; /* Exclude and include path parameters */ @@ -61,8 +62,6 @@ struct apply_state { static int newfd = -1; -static int p_value_known; - static const char * const apply_usage[] = { N_("git apply [<options>] [<patch>...]"), NULL @@ -875,14 +874,14 @@ static void parse_traditional_patch(struct apply_state *state, first += 4; /* skip "--- " */ second += 4; /* skip "+++ " */ - if (!p_value_known) { + if (!state->p_value_known) { int p, q; p = guess_p_value(state, first); q = guess_p_value(state, second); if (p < 0) p = q; if (0 <= p && p == q) { state->p_value = p; - p_value_known = 1; + state->p_value_known = 1; } } if (is_dev_null(first)) { @@ -4588,7 +4587,7 @@ static int option_parse_p(const struct option *opt, { struct apply_state *state = opt->value; state->p_value = atoi(arg); - p_value_known = 1; + state->p_value_known = 1; return 0; } |