Skip to content

Commit d281786

Browse files
author
Junio C Hamano
committed
xdiff: minor changes to match libxdiff-0.21
This reformats the change 621c53c introduced to match what upstream author implemented in libxdiff-0.21 without changing any logic (hopefully ;-). This is to help keep us in sync with the upstream. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 0da4677 commit d281786

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

xdiff/xutils.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,18 @@ long xdl_bogosqrt(long n) {
4444

4545
int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
4646
xdemitcb_t *ecb) {
47+
int i = 2;
4748
mmbuffer_t mb[3];
48-
int i;
4949

5050
mb[0].ptr = (char *) pre;
5151
mb[0].size = psize;
5252
mb[1].ptr = (char *) rec;
5353
mb[1].size = size;
54-
i = 2;
55-
56-
if (!size || rec[size-1] != '\n') {
57-
mb[2].ptr = "\n\\ No newline at end of file\n";
54+
if (size > 0 && rec[size - 1] != '\n') {
55+
mb[2].ptr = (char *) "\n\\ No newline at end of file\n";
5856
mb[2].size = strlen(mb[2].ptr);
59-
i = 3;
57+
i++;
6058
}
61-
6259
if (ecb->outf(ecb->priv, mb, i) < 0) {
6360

6461
return -1;

xdiff/xutils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define XUTILS_H
2525

2626

27+
2728
long xdl_bogosqrt(long n);
2829
int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
2930
xdemitcb_t *ecb);

0 commit comments

Comments
 (0)