aboutsummaryrefslogtreecommitdiff
path: root/xdiff/xutils.c
diff options
context:
space:
mode:
authorDavide Libenzi <davidel@xmailserver.org>2006-04-03 18:47:55 -0700
committerJunio C Hamano <junkio@cox.net>2006-04-04 00:11:09 -0700
commitca557afff9f7dad7a8739cd193ac0730d872e282 (patch)
treea5280cb50743f26130e9dabcea0fc7a92f8dc193 /xdiff/xutils.c
parentfc9957b0052df6a8248420395bc9febd66194252 (diff)
downloadgit-ca557afff9f7dad7a8739cd193ac0730d872e282.tar.gz
git-ca557afff9f7dad7a8739cd193ac0730d872e282.tar.xz
Clean-up trivially redundant diff.
Also corrects the line numbers in unified output when using zero lines context.
Diffstat (limited to 'xdiff/xutils.c')
-rw-r--r--xdiff/xutils.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index afaada1ed..21ab8e7e2 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -29,6 +29,19 @@
+long xdl_bogosqrt(long n) {
+ long i;
+
+ /*
+ * Classical integer square root approximation using shifts.
+ */
+ for (i = 1; n > 0; n >>= 2)
+ i <<= 1;
+
+ return i;
+}
+
+
int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,
xdemitcb_t *ecb) {
mmbuffer_t mb[3];
@@ -244,7 +257,7 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
memcpy(buf, "@@ -", 4);
nb += 4;
- nb += xdl_num_out(buf + nb, c1 ? s1: 0);
+ nb += xdl_num_out(buf + nb, c1 ? s1: s1 - 1);
if (c1 != 1) {
memcpy(buf + nb, ",", 1);
@@ -256,7 +269,7 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
memcpy(buf + nb, " +", 2);
nb += 2;
- nb += xdl_num_out(buf + nb, c2 ? s2: 0);
+ nb += xdl_num_out(buf + nb, c2 ? s2: s2 - 1);
if (c2 != 1) {
memcpy(buf + nb, ",", 1);