]> asedeno.scripts.mit.edu Git - git.git/commitdiff
xdiff: minor changes to match libxdiff-0.21
authorJunio C Hamano <junkio@cox.net>
Tue, 20 Jun 2006 00:01:35 +0000 (17:01 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 20 Jun 2006 01:43:49 +0000 (18:43 -0700)
This reformats the change 621c53cc082299eaf69e9f2dc0274547c7d87fb0
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>
xdiff/xutils.c
xdiff/xutils.h

index 21ab8e7e263983b54c07e44150cedc5c43963a35..f91b4034751df72996afbe6b4b04a9f05638d322 100644 (file)
@@ -44,21 +44,18 @@ long xdl_bogosqrt(long n) {
 
 int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
                     xdemitcb_t *ecb) {
+       int i = 2;
        mmbuffer_t mb[3];
-       int i;
 
        mb[0].ptr = (char *) pre;
        mb[0].size = psize;
        mb[1].ptr = (char *) rec;
        mb[1].size = size;
-       i = 2;
-
-       if (!size || rec[size-1] != '\n') {
-               mb[2].ptr = "\n\\ No newline at end of file\n";
+       if (size > 0 && rec[size - 1] != '\n') {
+               mb[2].ptr = (char *) "\n\\ No newline at end of file\n";
                mb[2].size = strlen(mb[2].ptr);
-               i = 3;
+               i++;
        }
-
        if (ecb->outf(ecb->priv, mb, i) < 0) {
 
                return -1;
index ea38ee903fa142742797feb600b691b5a22b8165..08691a2447126a8a8f96bb8a0369f21524c58c39 100644 (file)
@@ -24,6 +24,7 @@
 #define XUTILS_H
 
 
+
 long xdl_bogosqrt(long n);
 int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
                     xdemitcb_t *ecb);