Code

git-diff: fix combined diff
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Fri, 23 Feb 2007 04:20:32 +0000 (05:20 +0100)
committerJunio C Hamano <junkio@cox.net>
Fri, 23 Feb 2007 05:24:34 +0000 (21:24 -0800)
The code forgets that typecast binds tighter than addition, in
other words:

    (cast *)array + i  === ((cast *)array) + i

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-diff.c

index a6590205e8f746304f3d06d3e328a05bf2bf954e..c387ebb16c6bd353a84abd9454892eeab309ef1e 100644 (file)
@@ -192,7 +192,8 @@ static int builtin_diff_combined(struct rev_info *revs,
        parent = xmalloc(ents * sizeof(*parent));
        /* Again, the revs are all reverse */
        for (i = 0; i < ents; i++)
-               hashcpy((unsigned char*)parent + i, ent[ents - 1 - i].item->sha1);
+               hashcpy((unsigned char *)(parent + i),
+                       ent[ents - 1 - i].item->sha1);
        diff_tree_combined(parent[0], parent + 1, ents - 1,
                           revs->dense_combined_merges, revs);
        return 0;