diff: omit found pointer from emit_callback

We keep the actual data in the diff options, which are just as accessible.
Remove the pointer stored in struct emit_callback for readability.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2016-09-07 16:36:46 -07:00 committed by Junio C Hamano
parent fb33b62ca6
commit ba16233ccd

6
diff.c
View File

@ -354,7 +354,6 @@ struct emit_callback {
const char **label_path; const char **label_path;
struct diff_words_data *diff_words; struct diff_words_data *diff_words;
struct diff_options *opt; struct diff_options *opt;
int *found_changesp;
struct strbuf *header; struct strbuf *header;
}; };
@ -722,7 +721,6 @@ static void emit_rewrite_diff(const char *name_a,
memset(&ecbdata, 0, sizeof(ecbdata)); memset(&ecbdata, 0, sizeof(ecbdata));
ecbdata.color_diff = want_color(o->use_color); ecbdata.color_diff = want_color(o->use_color);
ecbdata.found_changesp = &o->found_changes;
ecbdata.ws_rule = whitespace_rule(name_b); ecbdata.ws_rule = whitespace_rule(name_b);
ecbdata.opt = o; ecbdata.opt = o;
if (ecbdata.ws_rule & WS_BLANK_AT_EOF) { if (ecbdata.ws_rule & WS_BLANK_AT_EOF) {
@ -1216,12 +1214,13 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
struct diff_options *o = ecbdata->opt; struct diff_options *o = ecbdata->opt;
const char *line_prefix = diff_line_prefix(o); const char *line_prefix = diff_line_prefix(o);
o->found_changes = 1;
if (ecbdata->header) { if (ecbdata->header) {
fprintf(o->file, "%s", ecbdata->header->buf); fprintf(o->file, "%s", ecbdata->header->buf);
strbuf_reset(ecbdata->header); strbuf_reset(ecbdata->header);
ecbdata->header = NULL; ecbdata->header = NULL;
} }
*(ecbdata->found_changesp) = 1;
if (ecbdata->label_path[0]) { if (ecbdata->label_path[0]) {
const char *name_a_tab, *name_b_tab; const char *name_a_tab, *name_b_tab;
@ -2437,7 +2436,6 @@ static void builtin_diff(const char *name_a,
memset(&ecbdata, 0, sizeof(ecbdata)); memset(&ecbdata, 0, sizeof(ecbdata));
ecbdata.label_path = lbl; ecbdata.label_path = lbl;
ecbdata.color_diff = want_color(o->use_color); ecbdata.color_diff = want_color(o->use_color);
ecbdata.found_changesp = &o->found_changes;
ecbdata.ws_rule = whitespace_rule(name_b); ecbdata.ws_rule = whitespace_rule(name_b);
if (ecbdata.ws_rule & WS_BLANK_AT_EOF) if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
check_blank_at_eof(&mf1, &mf2, &ecbdata); check_blank_at_eof(&mf1, &mf2, &ecbdata);