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 <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Sep 7, 2016 at 16:36 UTC
fb33b62ca6e6dbfa8a5330cb0535fe122e250b5f
1 file changed
+10
-11
diff.c
+10
-11
@@ -1217,7 +1217,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1217
const char *line_prefix = diff_line_prefix(o);
1218
1219
if (ecbdata->header) {
1220
- fprintf(ecbdata->opt->file, "%s", ecbdata->header->buf);
1220
+ fprintf(o->file, "%s", ecbdata->header->buf);
1221
strbuf_reset(ecbdata->header);
1222
ecbdata->header = NULL;
1223
}
@@ -1229,9 +1229,9 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1229
name_a_tab = strchr(ecbdata->label_path[0], ' ') ? "\t" : "";
1230
name_b_tab = strchr(ecbdata->label_path[1], ' ') ? "\t" : "";
1231
1232
- fprintf(ecbdata->opt->file, "%s%s--- %s%s%s\n",
1232
+ fprintf(o->file, "%s%s--- %s%s%s\n",
1233
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",
1235
line_prefix, meta, ecbdata->label_path[1], reset, name_b_tab);
1236
ecbdata->label_path[0] = ecbdata->label_path[1] = NULL;
1237
}
@@ -1249,15 +1249,15 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1249
find_lno(line, ecbdata);
1250
emit_hunk_header(ecbdata, line, len);
1251
if (line[len-1] != '\n')
1252
- putc('\n', ecbdata->opt->file);
1252
+ putc('\n', o->file);
1253
return;
1254
}
1255
1256
if (len < 1) {
1257
- emit_line(ecbdata->opt, reset, reset, line, len);
1257
+ emit_line(o, reset, reset, line, len);
1258
if (ecbdata->diff_words
1259
&& ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN)
1260
- fputs("~\n", ecbdata->opt->file);
1260
+ fputs("~\n", o->file);
1261
return;
1262
}
1263
@@ -1282,8 +1282,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1282
}
1283
diff_words_flush(ecbdata);
1284
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);
1287
} else {
1288
/*
1289
* Skip the prefix character, if any. With
@@ -1294,7 +1294,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1294
line++;
1295
len--;
1296
}
1297
- emit_line(ecbdata->opt, context, reset, line, len);
1297
+ emit_line(o, context, reset, line, len);
1298
}
1299
return;
1300
}
@@ -1316,8 +1316,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1316
default:
1317
/* incomplete line at the end */
1318
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),
1320
reset, line, len);
1321
break;
1322
}