diff: remove DIFF_OPT_TST macro

Remove the `DIFF_OPT_TST` macro and instead access the flags directly.
This conversion is done using the following semantic patch:

	@@
	expression E;
	identifier fld;
	@@
	- DIFF_OPT_TST(&E, fld)
	+ E.flags.fld

	@@
	type T;
	T *ptr;
	identifier fld;
	@@
	- DIFF_OPT_TST(ptr, fld)
	+ ptr->flags.fld

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-10-31 11:19:08 -07:00
committed by Junio C Hamano
parent 25567af805
commit 3b69daed86
17 changed files with 84 additions and 84 deletions

View File

@ -131,7 +131,7 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
if (!DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two))
return 0;
if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
if (o->flags.ALLOW_TEXTCONV) {
textconv_one = get_textconv(p->one);
textconv_two = get_textconv(p->two);
}
@ -222,11 +222,11 @@ void diffcore_pickaxe(struct diff_options *o)
if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
int cflags = REG_EXTENDED | REG_NEWLINE;
if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE))
if (o->flags.PICKAXE_IGNORE_CASE)
cflags |= REG_ICASE;
regcomp_or_die(&regex, needle, cflags);
regexp = &regex;
} else if (DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE) &&
} else if (o->flags.PICKAXE_IGNORE_CASE &&
has_non_ascii(needle)) {
struct strbuf sb = STRBUF_INIT;
int cflags = REG_NEWLINE | REG_ICASE;
@ -236,7 +236,7 @@ void diffcore_pickaxe(struct diff_options *o)
strbuf_release(&sb);
regexp = &regex;
} else {
kws = kwsalloc(DIFF_OPT_TST(o, PICKAXE_IGNORE_CASE)
kws = kwsalloc(o->flags.PICKAXE_IGNORE_CASE
? tolower_trans_tbl : NULL);
kwsincr(kws, needle, strlen(needle));
kwsprep(kws);