builtin/apply: move 'has_include' global into 'struct apply_state'
To libify the apply functionality the 'has_include' 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>
Christian Couder committed
May 24, 2016 at 10:11 UTC
0c1138cbdbf7a82f8373077b77a1878f742a5222
1 file changed
+3
-3
builtin/apply.c
+3
-3
@@ -55,6 +55,7 @@ struct apply_state {
55
56
/* Exclude and include path parameters */
57
struct string_list limit_by_name;
58
+ int has_include;
59
};
60
61
static int newfd = -1;
@@ -1961,7 +1962,6 @@ static void prefix_patch(struct apply_state *state, struct patch *p)
1962
* include/exclude
1963
*/
1964
1964
-static int has_include;
1965
static void add_name_limit(struct apply_state *state,
1966
const char *name,
1967
int exclude)
@@ -1997,7 +1997,7 @@ static int use_patch(struct apply_state *state, struct patch *p)
1997
* not used. Otherwise, we saw bunch of exclude rules (or none)
1998
* and such a path is used.
1999
*/
2000
- return !has_include;
2000
+ return !state->has_include;
2001
}
2002
2003
@@ -4534,7 +4534,7 @@ static int option_parse_include(const struct option *opt,
4534
{
4535
struct apply_state *state = opt->value;
4536
add_name_limit(state, arg, 0);
4537
- has_include = 1;
4537
+ state->has_include = 1;
4538
return 0;
4539
}
4540