Skip to content

Commit e04df61

Browse files
peffgitster
authored andcommitted
diff: drop unused color reset parameters
Several of the emit_* functions take a "reset" color parameter, but never actually look at it (instead, they call into emit_diff_symbol, which handles the colors itself). Let's drop these unused parameters. Note that emit_line() does still take a color/reset pair, and actually uses it. It cannot be refactored to match these other functions because it's the thing that emit_diff_symbol eventually calls into (i.e., it does not by itself know which colors to use, and must be told by the caller). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 784c0da commit e04df61

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

diff.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,8 +1613,7 @@ static int new_blank_line_at_eof(struct emit_callback *ecbdata, const char *line
16131613
return ws_blank_line(line, len, ecbdata->ws_rule);
16141614
}
16151615

1616-
static void emit_add_line(const char *reset,
1617-
struct emit_callback *ecbdata,
1616+
static void emit_add_line(struct emit_callback *ecbdata,
16181617
const char *line, int len)
16191618
{
16201619
unsigned flags = WSEH_NEW | ecbdata->ws_rule;
@@ -1624,16 +1623,14 @@ static void emit_add_line(const char *reset,
16241623
emit_diff_symbol(ecbdata->opt, DIFF_SYMBOL_PLUS, line, len, flags);
16251624
}
16261625

1627-
static void emit_del_line(const char *reset,
1628-
struct emit_callback *ecbdata,
1626+
static void emit_del_line(struct emit_callback *ecbdata,
16291627
const char *line, int len)
16301628
{
16311629
unsigned flags = WSEH_OLD | ecbdata->ws_rule;
16321630
emit_diff_symbol(ecbdata->opt, DIFF_SYMBOL_MINUS, line, len, flags);
16331631
}
16341632

1635-
static void emit_context_line(const char *reset,
1636-
struct emit_callback *ecbdata,
1633+
static void emit_context_line(struct emit_callback *ecbdata,
16371634
const char *line, int len)
16381635
{
16391636
unsigned flags = WSEH_CONTEXT | ecbdata->ws_rule;
@@ -1742,7 +1739,6 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
17421739
int prefix, const char *data, int size)
17431740
{
17441741
const char *endp = NULL;
1745-
const char *reset = diff_get_color(ecb->color_diff, DIFF_RESET);
17461742

17471743
while (0 < size) {
17481744
int len;
@@ -1751,10 +1747,10 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
17511747
len = endp ? (endp - data + 1) : size;
17521748
if (prefix != '+') {
17531749
ecb->lno_in_preimage++;
1754-
emit_del_line(reset, ecb, data, len);
1750+
emit_del_line(ecb, data, len);
17551751
} else {
17561752
ecb->lno_in_postimage++;
1757-
emit_add_line(reset, ecb, data, len);
1753+
emit_add_line(ecb, data, len);
17581754
}
17591755
size -= len;
17601756
data += len;
@@ -2325,7 +2321,6 @@ static void find_lno(const char *line, struct emit_callback *ecbdata)
23252321
static void fn_out_consume(void *priv, char *line, unsigned long len)
23262322
{
23272323
struct emit_callback *ecbdata = priv;
2328-
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
23292324
struct diff_options *o = ecbdata->opt;
23302325

23312326
o->found_changes = 1;
@@ -2392,16 +2387,16 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
23922387
switch (line[0]) {
23932388
case '+':
23942389
ecbdata->lno_in_postimage++;
2395-
emit_add_line(reset, ecbdata, line + 1, len - 1);
2390+
emit_add_line(ecbdata, line + 1, len - 1);
23962391
break;
23972392
case '-':
23982393
ecbdata->lno_in_preimage++;
2399-
emit_del_line(reset, ecbdata, line + 1, len - 1);
2394+
emit_del_line(ecbdata, line + 1, len - 1);
24002395
break;
24012396
case ' ':
24022397
ecbdata->lno_in_postimage++;
24032398
ecbdata->lno_in_preimage++;
2404-
emit_context_line(reset, ecbdata, line + 1, len - 1);
2399+
emit_context_line(ecbdata, line + 1, len - 1);
24052400
break;
24062401
default:
24072402
/* incomplete line at the end */

0 commit comments

Comments
 (0)