git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] strbuf.h: use BUG(...) not die("BUG: ...")

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 7, 2021, 11:05 UTC
Message-ID
<patch-v2-2.4-6740c5d0da8-20211207T110440Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.4-00000000000-20211207T110440Z-avarab@gmail.com>

In 7141efab248 (strbuf: clarify assertion in strbuf_setlen(), 2011-04-27) this 'die("BUG: "' invocation was added with the rationale that strbuf.c had existing users doing the same, but those users were later changed to use BUG() in 033abf97fcb (Replace all die("BUG: ...") calls by BUG() ones, 2018-05-02). Let's do the same here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 strbuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/strbuf.h b/strbuf.h
index 96512f85b31..76965a17d44 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -160,7 +160,7 @@ void strbuf_grow(struct strbuf *sb, size_t amount);
 static inline void strbuf_setlen(struct strbuf *sb, size_t len)
 {
 	if (len > (sb->alloc ? sb->alloc - 1 : 0))
-		die("BUG: strbuf_setlen() beyond buffer");
+		BUG("strbuf_setlen() beyond buffer");
 	sb->len = len;
 	if (sb->buf != strbuf_slopbuf)
 		sb->buf[len] = '\0';
-- 
2.34.1.898.g5a552c2e5f0
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 9 of 11 in “replace die("BUG: ...") with BUG("...")”
  1. 0/2 replace die("BUG: ...") with BUG("...")Ævar Arnfjörð Bjarmason, Dec 6, 2021
  2. 1/2 pack-objects: use BUG(...) not die("BUG: ...")Ævar Arnfjörð Bjarmason, Dec 6, 2021
  3. 2/2 strbuf.h: use BUG(...) not die("BUG: ...")Ævar Arnfjörð Bjarmason, Dec 6, 2021
  4. Junio C HamanoDec 6, 2021
  5. Ævar Arnfjörð BjarmasonDec 7, 2021
  6. 3/2 replace die("BUG: ...") with BUG("...")Junio C Hamano, Dec 7, 2021
  7. 0/4 replace die("BUG: ...") with BUG("...")Ævar Arnfjörð Bjarmason, Dec 7, 2021
  8. 1/4 pack-objects: use BUG(...) not die("BUG: ...")Ævar Arnfjörð Bjarmason, Dec 7, 2021
  9. 2/4 strbuf.h: use BUG(...) not die("BUG: ...")Ævar Arnfjörð Bjarmason, Dec 7, 2021
  10. 3/4 pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>)Ævar Arnfjörð Bjarmason, Dec 7, 2021
  11. 4/4 object.h: use BUG(...) no die("BUG: ...") in lookup_object_by_type()Ævar Arnfjörð Bjarmason, Dec 7, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.