summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-08 13:15:04 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-08 13:15:04 -0700
commit8e48f115aa742e2389beda39fa08e9d96ec9b084 (patch)
treec2782be94b86163c422de32b8a1e0ed7eb16375f
parentMerge branch 'ms/mergetools-kdiff3-on-windows' (diff)
parentxdiff: use BUG(...), not xdl_bug(...) (diff)
downloadtgif-8e48f115aa742e2389beda39fa08e9d96ec9b084.tar.xz
Merge branch 'ab/xdiff-bug-cleanup'
Code clean-up. * ab/xdiff-bug-cleanup: xdiff: use BUG(...), not xdl_bug(...)
-rw-r--r--xdiff/xdiffi.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 380eb728ed..a4542c05b6 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -796,12 +796,6 @@ static int group_slide_up(xdfile_t *xdf, struct xdlgroup *g, long flags)
}
}
-static void xdl_bug(const char *msg)
-{
- fprintf(stderr, "BUG: %s\n", msg);
- exit(1);
-}
-
/*
* Move back and forward change groups for a consistent and pretty diff output.
* 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) {
/* Shift the group backward as much as possible: */
while (!group_slide_up(xdf, &g, flags))
if (group_previous(xdfo, &go))
- xdl_bug("group sync broken sliding up");
+ BUG("group sync broken sliding up");
/*
* 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) {
if (group_slide_down(xdf, &g, flags))
break;
if (group_next(xdfo, &go))
- xdl_bug("group sync broken sliding down");
+ BUG("group sync broken sliding down");
if (go.end > go.start)
end_matching_other = g.end;
@@ -882,9 +876,9 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
*/
while (go.end == go.start) {
if (group_slide_up(xdf, &g, flags))
- xdl_bug("match disappeared");
+ BUG("match disappeared");
if (group_previous(xdfo, &go))
- xdl_bug("group sync broken sliding to match");
+ BUG("group sync broken sliding to match");
}
} else if (flags & XDF_INDENT_HEURISTIC) {
/*
@@ -925,9 +919,9 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
while (g.end > best_shift) {
if (group_slide_up(xdf, &g, flags))
- xdl_bug("best shift unreached");
+ BUG("best shift unreached");
if (group_previous(xdfo, &go))
- xdl_bug("group sync broken sliding to blank line");
+ BUG("group sync broken sliding to blank line");
}
}
@@ -936,11 +930,11 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
if (group_next(xdf, &g))
break;
if (group_next(xdfo, &go))
- xdl_bug("group sync broken moving to next group");
+ BUG("group sync broken moving to next group");
}
if (!group_next(xdfo, &go))
- xdl_bug("group sync broken at end of file");
+ BUG("group sync broken at end of file");
return 0;
}