Skip to content

Commit ba16233

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb33b62 commit ba16233

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

diff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ struct emit_callback {
354354
const char **label_path;
355355
struct diff_words_data *diff_words;
356356
struct diff_options *opt;
357-
int *found_changesp;
358357
struct strbuf *header;
359358
};
360359

@@ -722,7 +721,6 @@ static void emit_rewrite_diff(const char *name_a,
722721

723722
memset(&ecbdata, 0, sizeof(ecbdata));
724723
ecbdata.color_diff = want_color(o->use_color);
725-
ecbdata.found_changesp = &o->found_changes;
726724
ecbdata.ws_rule = whitespace_rule(name_b);
727725
ecbdata.opt = o;
728726
if (ecbdata.ws_rule & WS_BLANK_AT_EOF) {
@@ -1216,12 +1214,13 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12161214
struct diff_options *o = ecbdata->opt;
12171215
const char *line_prefix = diff_line_prefix(o);
12181216

1217+
o->found_changes = 1;
1218+
12191219
if (ecbdata->header) {
12201220
fprintf(o->file, "%s", ecbdata->header->buf);
12211221
strbuf_reset(ecbdata->header);
12221222
ecbdata->header = NULL;
12231223
}
1224-
*(ecbdata->found_changesp) = 1;
12251224

12261225
if (ecbdata->label_path[0]) {
12271226
const char *name_a_tab, *name_b_tab;
@@ -2437,7 +2436,6 @@ static void builtin_diff(const char *name_a,
24372436
memset(&ecbdata, 0, sizeof(ecbdata));
24382437
ecbdata.label_path = lbl;
24392438
ecbdata.color_diff = want_color(o->use_color);
2440-
ecbdata.found_changesp = &o->found_changes;
24412439
ecbdata.ws_rule = whitespace_rule(name_b);
24422440
if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
24432441
check_blank_at_eof(&mf1, &mf2, &ecbdata);

0 commit comments

Comments
 (0)