From 0136b08a108903676b81f1a41f82366551986165 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Tue, 30 Jul 2024 00:42:51 +0000 Subject: [PATCH] merge3: fix exit conditions -- l, r are never nil --- sys/src/cmd/diff/merge3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/src/cmd/diff/merge3.c b/sys/src/cmd/diff/merge3.c index 26397f3fe..ba64c573c 100644 --- a/sys/src/cmd/diff/merge3.c +++ b/sys/src/cmd/diff/merge3.c @@ -117,7 +117,7 @@ merge(Diff *l, Diff *r) rx = (rc->oldx < rc->oldy) ? rc->oldx : rc->oldy; ry = (rc->oldx < rc->oldy) ? rc->oldy : rc->oldx; } - if(l != nil && r != nil && overlaps(lx, ly, rx, ry)){ + if(lc != nil && rc != nil && overlaps(lx, ly, rx, ry)){ /* * align the edges of the chunks */ @@ -160,12 +160,12 @@ merge(Diff *l, Diff *r) ln = y+1; il++; ir++; - }else if(rc == nil || (lc != nil && lx < rx)){ + }else if(lc != nil && (rc == nil || lx < rx)){ fetch(l, l->ixold, ln, lc->oldx-1, l->input[0], ""); fetch(l, l->ixnew, lc->newx, lc->newy, l->input[1], ""); ln = lc->oldy+1; il++; - }else if(lc == nil || (rc != nil && rx < lx)){ + }else if(rc != nil && (lc == nil || rx < lx)){ fetch(l, l->ixold, ln, rc->oldx-1, l->input[0], ""); fetch(r, r->ixnew, rc->newx, rc->newy, r->input[1], ""); ln = rc->oldy+1;