diff.h: avoid bit fields in struct diff_flags
Bitfield addresses cannot be passed around in a pointer. This makes it hard to use parse-options to set/unset them. Turn this struct to normal integers. This of course increases the size of this struct multiple times, but since we only have a handful of diff_options variables around, memory consumption is not at all a concern. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Jan 27, 2019 at 07:35 UTC
2b393ef357d2fe466ba7097c9cc3ec92798ec05f
1 file changed
+33
-33
diff.h
+33
-33
@@ -64,39 +64,39 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
64
65
#define DIFF_FLAGS_INIT { 0 }
66
struct diff_flags {
67
- unsigned recursive:1;
68
- unsigned tree_in_recursive:1;
69
- unsigned binary:1;
70
- unsigned text:1;
71
- unsigned full_index:1;
72
- unsigned silent_on_remove:1;
73
- unsigned find_copies_harder:1;
74
- unsigned follow_renames:1;
75
- unsigned rename_empty:1;
76
- unsigned has_changes:1;
77
- unsigned quick:1;
78
- unsigned no_index:1;
79
- unsigned allow_external:1;
80
- unsigned exit_with_status:1;
81
- unsigned reverse_diff:1;
82
- unsigned check_failed:1;
83
- unsigned relative_name:1;
84
- unsigned ignore_submodules:1;
85
- unsigned dirstat_cumulative:1;
86
- unsigned dirstat_by_file:1;
87
- unsigned allow_textconv:1;
88
- unsigned textconv_set_via_cmdline:1;
89
- unsigned diff_from_contents:1;
90
- unsigned dirty_submodules:1;
91
- unsigned ignore_untracked_in_submodules:1;
92
- unsigned ignore_dirty_submodules:1;
93
- unsigned override_submodule_config:1;
94
- unsigned dirstat_by_line:1;
95
- unsigned funccontext:1;
96
- unsigned default_follow_renames:1;
97
- unsigned stat_with_summary:1;
98
- unsigned suppress_diff_headers:1;
99
- unsigned dual_color_diffed_diffs:1;
67
+ unsigned recursive;
68
+ unsigned tree_in_recursive;
69
+ unsigned binary;
70
+ unsigned text;
71
+ unsigned full_index;
72
+ unsigned silent_on_remove;
73
+ unsigned find_copies_harder;
74
+ unsigned follow_renames;
75
+ unsigned rename_empty;
76
+ unsigned has_changes;
77
+ unsigned quick;
78
+ unsigned no_index;
79
+ unsigned allow_external;
80
+ unsigned exit_with_status;
81
+ unsigned reverse_diff;
82
+ unsigned check_failed;
83
+ unsigned relative_name;
84
+ unsigned ignore_submodules;
85
+ unsigned dirstat_cumulative;
86
+ unsigned dirstat_by_file;
87
+ unsigned allow_textconv;
88
+ unsigned textconv_set_via_cmdline;
89
+ unsigned diff_from_contents;
90
+ unsigned dirty_submodules;
91
+ unsigned ignore_untracked_in_submodules;
92
+ unsigned ignore_dirty_submodules;
93
+ unsigned override_submodule_config;
94
+ unsigned dirstat_by_line;
95
+ unsigned funccontext;
96
+ unsigned default_follow_renames;
97
+ unsigned stat_with_summary;
98
+ unsigned suppress_diff_headers;
99
+ unsigned dual_color_diffed_diffs;
100
};
101
102
static inline void diff_flags_or(struct diff_flags *a,