Skip to content

Commit 4d8c51a

Browse files
stefanbellergitster
authored andcommitted
diff: use HAS_MULTI_BITS instead of counting bits manually
This aligns the style to the previous patch. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5e50525 commit 4d8c51a

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

diff.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,20 +4107,15 @@ void diff_setup(struct diff_options *options)
41074107

41084108
void diff_setup_done(struct diff_options *options)
41094109
{
4110-
int count = 0;
4110+
unsigned check_mask = DIFF_FORMAT_NAME |
4111+
DIFF_FORMAT_NAME_STATUS |
4112+
DIFF_FORMAT_CHECKDIFF |
4113+
DIFF_FORMAT_NO_OUTPUT;
41114114

41124115
if (options->set_default)
41134116
options->set_default(options);
41144117

4115-
if (options->output_format & DIFF_FORMAT_NAME)
4116-
count++;
4117-
if (options->output_format & DIFF_FORMAT_NAME_STATUS)
4118-
count++;
4119-
if (options->output_format & DIFF_FORMAT_CHECKDIFF)
4120-
count++;
4121-
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
4122-
count++;
4123-
if (count > 1)
4118+
if (HAS_MULTI_BITS(options->output_format & check_mask))
41244119
die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
41254120

41264121
if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))

0 commit comments

Comments
 (0)