@matheusbsbs / matheus-bagliano / commits / 628d5c2b70
Fork 0

Use DIFF_XDL_SET/DIFF_OPT_SET instead of raw bit-masking

Signed-off-by: Keith Cascio <keith@cs.ucla.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Keith Cascio committed Feb 16, 2009 at 19:26 UTC 628d5c2b707db207e47c42ca112b182aa171cfaa
2 files changed +13 -7
diff.c
+10 -7
@@ -2567,13 +2567,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
2567
2568 /* xdiff options */
2569 else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
2570 - options->xdl_opts |= XDF_IGNORE_WHITESPACE;
2570 + DIFF_XDL_SET(options, IGNORE_WHITESPACE);
2571 else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
2572 - options->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
2572 + DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE);
2573 else if (!strcmp(arg, "--ignore-space-at-eol"))
2574 - options->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
2574 + DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);
2575 else if (!strcmp(arg, "--patience"))
2576 - options->xdl_opts |= XDF_PATIENCE_DIFF;
2576 + DIFF_XDL_SET(options, PATIENCE_DIFF);
2577
2578 /* flags options */
2579 else if (!strcmp(arg, "--binary")) {
@@ -2594,10 +2594,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
2594 DIFF_OPT_SET(options, COLOR_DIFF);
2595 else if (!strcmp(arg, "--no-color"))
2596 DIFF_OPT_CLR(options, COLOR_DIFF);
2597 - else if (!strcmp(arg, "--color-words"))
2598 - options->flags |= DIFF_OPT_COLOR_DIFF | DIFF_OPT_COLOR_DIFF_WORDS;
2597 + else if (!strcmp(arg, "--color-words")) {
2598 + DIFF_OPT_SET(options, COLOR_DIFF);
2599 + DIFF_OPT_SET(options, COLOR_DIFF_WORDS);
2600 + }
2601 else if (!prefixcmp(arg, "--color-words=")) {
2600 - options->flags |= DIFF_OPT_COLOR_DIFF | DIFF_OPT_COLOR_DIFF_WORDS;
2602 + DIFF_OPT_SET(options, COLOR_DIFF);
2603 + DIFF_OPT_SET(options, COLOR_DIFF_WORDS);
2604 options->word_regex = arg + 14;
2605 }
2606 else if (!strcmp(arg, "--exit-code"))
diff.h
+3
@@ -69,6 +69,9 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
69 #define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
70 #define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
71 #define DIFF_OPT_CLR(opts, flag) ((opts)->flags &= ~DIFF_OPT_##flag)
72 +#define DIFF_XDL_TST(opts, flag) ((opts)->xdl_opts & XDF_##flag)
73 +#define DIFF_XDL_SET(opts, flag) ((opts)->xdl_opts |= XDF_##flag)
74 +#define DIFF_XDL_CLR(opts, flag) ((opts)->xdl_opts &= ~XDF_##flag)
75
76 struct diff_options {
77 const char *filter;