diff options
author | Christian Couder <christian.couder@gmail.com> | 2016-07-30 19:24:57 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-01 14:59:38 -0700 |
commit | 6ab920f9fb0e4720a22dd605eb5d37e56ece9742 (patch) | |
tree | fd77adef06681e248ed6827f454d14f8f0e3689b | |
parent | fad3608463829a526d0cce9d52a954e47e8e6dd6 (diff) | |
download | git-6ab920f9fb0e4720a22dd605eb5d37e56ece9742.tar.gz |
apply: rename and move opt constants to apply.h
The constants for the "inaccurate-eof" and the "recount" options will
be used in both "apply.c" and "builtin/apply.c", so they need to go
into "apply.h", and therefore they need a name that is more specific
to the API they belong to.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | apply.h | 3 | ||||
-rw-r--r-- | builtin/apply.c | 11 |
2 files changed, 7 insertions, 7 deletions
@@ -108,4 +108,7 @@ extern int init_apply_state(struct apply_state *state, extern void clear_apply_state(struct apply_state *state); extern int check_apply_state(struct apply_state *state, int force_apply); +#define APPLY_OPT_INACCURATE_EOF (1<<0) +#define APPLY_OPT_RECOUNT (1<<1) + #endif diff --git a/builtin/apply.c b/builtin/apply.c index c7e570a390..486e5f747a 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4460,9 +4460,6 @@ static int write_out_results(struct apply_state *state, struct patch *list) static struct lock_file lock_file; -#define INACCURATE_EOF (1<<0) -#define RECOUNT (1<<1) - /* * Try to apply a patch. * @@ -4492,8 +4489,8 @@ static int apply_patch(struct apply_state *state, int nr; patch = xcalloc(1, sizeof(*patch)); - patch->inaccurate_eof = !!(options & INACCURATE_EOF); - patch->recount = !!(options & RECOUNT); + patch->inaccurate_eof = !!(options & APPLY_OPT_INACCURATE_EOF); + patch->recount = !!(options & APPLY_OPT_RECOUNT); nr = parse_chunk(state, buf.buf + offset, buf.len - offset, patch); if (nr < 0) { free_patch(patch); @@ -4808,10 +4805,10 @@ int cmd_apply(int argc, const char **argv, const char *prefix) OPT__VERBOSE(&state.apply_verbosely, N_("be verbose")), OPT_BIT(0, "inaccurate-eof", &options, N_("tolerate incorrectly detected missing new-line at the end of file"), - INACCURATE_EOF), + APPLY_OPT_INACCURATE_EOF), OPT_BIT(0, "recount", &options, N_("do not trust the line counts in the hunk headers"), - RECOUNT), + APPLY_OPT_RECOUNT), { OPTION_CALLBACK, 0, "directory", &state, N_("root"), N_("prepend <root> to all filenames"), 0, apply_option_parse_directory }, |