Use a single implementation and API for copy_file()

Originally by Kristian Hᅵgsberg; I fixed the conversion of rerere, which
had a different API.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Daniel Barkalow
2008-02-25 14:24:48 -05:00
committed by Junio C Hamano
parent ed10d9aa3f
commit 1468bd4783
5 changed files with 27 additions and 43 deletions

8
diff.c
View File

@ -272,8 +272,8 @@ static void print_line_count(int count)
}
}
static void copy_file(int prefix, const char *data, int size,
const char *set, const char *reset)
static void copy_file_with_prefix(int prefix, const char *data, int size,
const char *set, const char *reset)
{
int ch, nl_just_seen = 1;
while (0 < size--) {
@ -331,9 +331,9 @@ static void emit_rewrite_diff(const char *name_a,
print_line_count(lc_b);
printf(" @@%s\n", reset);
if (lc_a)
copy_file('-', one->data, one->size, old, reset);
copy_file_with_prefix('-', one->data, one->size, old, reset);
if (lc_b)
copy_file('+', two->data, two->size, new, reset);
copy_file_with_prefix('+', two->data, two->size, new, reset);
}
static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one)