From 3b69daed861daec1923c369d59c97e46eb3c3d7b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:08 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- diffcore-pickaxe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'diffcore-pickaxe.c') diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 341529b5a..6193c07f6 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -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(®ex, needle, cflags); regexp = ®ex; - } 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 = ®ex; } 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); -- cgit v1.2.1 From 0d1e0e7801bb2ae22036ad09f9f5cec17e08c48b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 31 Oct 2017 11:19:11 -0700 Subject: diff: make struct diff_flags members lowercase Now that the flags stored in struct diff_flags are being accessed directly and not through macros, change all struct members from being uppercase to lowercase. This conversion is done using the following semantic patch: @@ expression E; @@ - E.RECURSIVE + E.recursive @@ expression E; @@ - E.TREE_IN_RECURSIVE + E.tree_in_recursive @@ expression E; @@ - E.BINARY + E.binary @@ expression E; @@ - E.TEXT + E.text @@ expression E; @@ - E.FULL_INDEX + E.full_index @@ expression E; @@ - E.SILENT_ON_REMOVE + E.silent_on_remove @@ expression E; @@ - E.FIND_COPIES_HARDER + E.find_copies_harder @@ expression E; @@ - E.FOLLOW_RENAMES + E.follow_renames @@ expression E; @@ - E.RENAME_EMPTY + E.rename_empty @@ expression E; @@ - E.HAS_CHANGES + E.has_changes @@ expression E; @@ - E.QUICK + E.quick @@ expression E; @@ - E.NO_INDEX + E.no_index @@ expression E; @@ - E.ALLOW_EXTERNAL + E.allow_external @@ expression E; @@ - E.EXIT_WITH_STATUS + E.exit_with_status @@ expression E; @@ - E.REVERSE_DIFF + E.reverse_diff @@ expression E; @@ - E.CHECK_FAILED + E.check_failed @@ expression E; @@ - E.RELATIVE_NAME + E.relative_name @@ expression E; @@ - E.IGNORE_SUBMODULES + E.ignore_submodules @@ expression E; @@ - E.DIRSTAT_CUMULATIVE + E.dirstat_cumulative @@ expression E; @@ - E.DIRSTAT_BY_FILE + E.dirstat_by_file @@ expression E; @@ - E.ALLOW_TEXTCONV + E.allow_textconv @@ expression E; @@ - E.TEXTCONV_SET_VIA_CMDLINE + E.textconv_set_via_cmdline @@ expression E; @@ - E.DIFF_FROM_CONTENTS + E.diff_from_contents @@ expression E; @@ - E.DIRTY_SUBMODULES + E.dirty_submodules @@ expression E; @@ - E.IGNORE_UNTRACKED_IN_SUBMODULES + E.ignore_untracked_in_submodules @@ expression E; @@ - E.IGNORE_DIRTY_SUBMODULES + E.ignore_dirty_submodules @@ expression E; @@ - E.OVERRIDE_SUBMODULE_CONFIG + E.override_submodule_config @@ expression E; @@ - E.DIRSTAT_BY_LINE + E.dirstat_by_line @@ expression E; @@ - E.FUNCCONTEXT + E.funccontext @@ expression E; @@ - E.PICKAXE_IGNORE_CASE + E.pickaxe_ignore_case @@ expression E; @@ - E.DEFAULT_FOLLOW_RENAMES + E.default_follow_renames Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- diffcore-pickaxe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'diffcore-pickaxe.c') diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 6193c07f6..9476bd210 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -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 (o->flags.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 (o->flags.PICKAXE_IGNORE_CASE) + if (o->flags.pickaxe_ignore_case) cflags |= REG_ICASE; regcomp_or_die(®ex, needle, cflags); regexp = ®ex; - } else if (o->flags.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 = ®ex; } else { - kws = kwsalloc(o->flags.PICKAXE_IGNORE_CASE + kws = kwsalloc(o->flags.pickaxe_ignore_case ? tolower_trans_tbl : NULL); kwsincr(kws, needle, strlen(needle)); kwsprep(kws); -- cgit v1.2.1