Skip to content

Commit 8e48f11

Browse files
committed
Merge branch 'ab/xdiff-bug-cleanup'
Code clean-up. * ab/xdiff-bug-cleanup: xdiff: use BUG(...), not xdl_bug(...)
2 parents b7bd70d + 546096a commit 8e48f11

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

xdiff/xdiffi.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,6 @@ static int group_slide_up(xdfile_t *xdf, struct xdlgroup *g, long flags)
796796
}
797797
}
798798

799-
static void xdl_bug(const char *msg)
800-
{
801-
fprintf(stderr, "BUG: %s\n", msg);
802-
exit(1);
803-
}
804-
805799
/*
806800
* Move back and forward change groups for a consistent and pretty diff output.
807801
* This also helps in finding joinable change groups and reducing the diff
@@ -841,7 +835,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
841835
/* Shift the group backward as much as possible: */
842836
while (!group_slide_up(xdf, &g, flags))
843837
if (group_previous(xdfo, &go))
844-
xdl_bug("group sync broken sliding up");
838+
BUG("group sync broken sliding up");
845839

846840
/*
847841
* This is this highest that this group can be shifted.
@@ -857,7 +851,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
857851
if (group_slide_down(xdf, &g, flags))
858852
break;
859853
if (group_next(xdfo, &go))
860-
xdl_bug("group sync broken sliding down");
854+
BUG("group sync broken sliding down");
861855

862856
if (go.end > go.start)
863857
end_matching_other = g.end;
@@ -882,9 +876,9 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
882876
*/
883877
while (go.end == go.start) {
884878
if (group_slide_up(xdf, &g, flags))
885-
xdl_bug("match disappeared");
879+
BUG("match disappeared");
886880
if (group_previous(xdfo, &go))
887-
xdl_bug("group sync broken sliding to match");
881+
BUG("group sync broken sliding to match");
888882
}
889883
} else if (flags & XDF_INDENT_HEURISTIC) {
890884
/*
@@ -925,9 +919,9 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
925919

926920
while (g.end > best_shift) {
927921
if (group_slide_up(xdf, &g, flags))
928-
xdl_bug("best shift unreached");
922+
BUG("best shift unreached");
929923
if (group_previous(xdfo, &go))
930-
xdl_bug("group sync broken sliding to blank line");
924+
BUG("group sync broken sliding to blank line");
931925
}
932926
}
933927

@@ -936,11 +930,11 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
936930
if (group_next(xdf, &g))
937931
break;
938932
if (group_next(xdfo, &go))
939-
xdl_bug("group sync broken moving to next group");
933+
BUG("group sync broken moving to next group");
940934
}
941935

942936
if (!group_next(xdfo, &go))
943-
xdl_bug("group sync broken at end of file");
937+
BUG("group sync broken at end of file");
944938

945939
return 0;
946940
}

0 commit comments

Comments
 (0)