[PATCH 4/4] line-log: convert an assertion to a full BUG() call
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Aug 4, 2018, 22:18 UTC
- Message-ID
- <faf35214f0f339b792a30a3bd013056217d9a2c1.1533421101.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.15.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
The assertion in question really indicates a bug, when triggered, so we might just as well use the sanctioned method to report it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- line-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/line-log.c b/line-log.c index bc7ef69d6..0e09df9db 100644 --- a/line-log.c +++ b/line-log.c @@ -72,7 +72,9 @@ void range_set_append(struct range_set *rs, long a, long b) rs->ranges[rs->nr-1].end = b; return; } - assert(rs->nr == 0 || rs->ranges[rs->nr-1].end <= a); + if (rs->nr > 0 && rs->ranges[rs->nr-1].end > a) + BUG("append %ld-%ld, after %ld-%ld?!?", a, b, + rs->ranges[rs->nr-1].start, rs->ranges[rs->nr-1].end); range_set_append_unsafe(rs, a, b); }
-- gitgitgadget