Skip to content

Commit fb33b62

Browse files
stefanbellergitster
authored andcommitted
diff.c: use diff_options directly
The value of `ecbdata->opt` is accessible via the short variable `o` already, so let's use that instead. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ebdac1 commit fb33b62

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

diff.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12171217
const char *line_prefix = diff_line_prefix(o);
12181218

12191219
if (ecbdata->header) {
1220-
fprintf(ecbdata->opt->file, "%s", ecbdata->header->buf);
1220+
fprintf(o->file, "%s", ecbdata->header->buf);
12211221
strbuf_reset(ecbdata->header);
12221222
ecbdata->header = NULL;
12231223
}
@@ -1229,9 +1229,9 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12291229
name_a_tab = strchr(ecbdata->label_path[0], ' ') ? "\t" : "";
12301230
name_b_tab = strchr(ecbdata->label_path[1], ' ') ? "\t" : "";
12311231

1232-
fprintf(ecbdata->opt->file, "%s%s--- %s%s%s\n",
1232+
fprintf(o->file, "%s%s--- %s%s%s\n",
12331233
line_prefix, meta, ecbdata->label_path[0], reset, name_a_tab);
1234-
fprintf(ecbdata->opt->file, "%s%s+++ %s%s%s\n",
1234+
fprintf(o->file, "%s%s+++ %s%s%s\n",
12351235
line_prefix, meta, ecbdata->label_path[1], reset, name_b_tab);
12361236
ecbdata->label_path[0] = ecbdata->label_path[1] = NULL;
12371237
}
@@ -1249,15 +1249,15 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12491249
find_lno(line, ecbdata);
12501250
emit_hunk_header(ecbdata, line, len);
12511251
if (line[len-1] != '\n')
1252-
putc('\n', ecbdata->opt->file);
1252+
putc('\n', o->file);
12531253
return;
12541254
}
12551255

12561256
if (len < 1) {
1257-
emit_line(ecbdata->opt, reset, reset, line, len);
1257+
emit_line(o, reset, reset, line, len);
12581258
if (ecbdata->diff_words
12591259
&& ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN)
1260-
fputs("~\n", ecbdata->opt->file);
1260+
fputs("~\n", o->file);
12611261
return;
12621262
}
12631263

@@ -1282,8 +1282,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12821282
}
12831283
diff_words_flush(ecbdata);
12841284
if (ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN) {
1285-
emit_line(ecbdata->opt, context, reset, line, len);
1286-
fputs("~\n", ecbdata->opt->file);
1285+
emit_line(o, context, reset, line, len);
1286+
fputs("~\n", o->file);
12871287
} else {
12881288
/*
12891289
* Skip the prefix character, if any. With
@@ -1294,7 +1294,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12941294
line++;
12951295
len--;
12961296
}
1297-
emit_line(ecbdata->opt, context, reset, line, len);
1297+
emit_line(o, context, reset, line, len);
12981298
}
12991299
return;
13001300
}
@@ -1316,8 +1316,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
13161316
default:
13171317
/* incomplete line at the end */
13181318
ecbdata->lno_in_preimage++;
1319-
emit_line(ecbdata->opt,
1320-
diff_get_color(ecbdata->color_diff, DIFF_CONTEXT),
1319+
emit_line(o, diff_get_color(ecbdata->color_diff, DIFF_CONTEXT),
13211320
reset, line, len);
13221321
break;
13231322
}

0 commit comments

Comments
 (0)