git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"René Scharfe" <l.s.r@web.de>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 2/2] strbuf.h: use BUG(...) not die("BUG: ...")
Date: Mon,  6 Dec 2021 17:25:21 +0100	[thread overview]
Message-ID: <patch-2.2-ab89fec50c3-20211206T162442Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-0.2-00000000000-20211206T162442Z-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


  parent reply	other threads:[~2021-12-06 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 16:25 [PATCH 0/2] replace die("BUG: ...") with BUG("...") Ævar Arnfjörð Bjarmason
2021-12-06 16:25 ` [PATCH 1/2] pack-objects: use BUG(...) not die("BUG: ...") Ævar Arnfjörð Bjarmason
2021-12-06 16:25 ` Ævar Arnfjörð Bjarmason [this message]
2021-12-06 18:44 ` [PATCH 0/2] replace die("BUG: ...") with BUG("...") Junio C Hamano
2021-12-07 11:00   ` Ævar Arnfjörð Bjarmason
2021-12-07  0:24 ` [PATCH 3/2] " Junio C Hamano
2021-12-07 11:05 ` [PATCH v2 0/4] " Ævar Arnfjörð Bjarmason
2021-12-07 11:05   ` [PATCH v2 1/4] pack-objects: use BUG(...) not die("BUG: ...") Ævar Arnfjörð Bjarmason
2021-12-07 11:05   ` [PATCH v2 2/4] strbuf.h: " Ævar Arnfjörð Bjarmason
2021-12-07 11:05   ` [PATCH v2 3/4] pathspec: use BUG(...) not die("BUG:%s:%d....", <file>, <line>) Ævar Arnfjörð Bjarmason
2021-12-07 11:05   ` [PATCH v2 4/4] object.h: use BUG(...) no die("BUG: ...") in lookup_object_by_type() Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-2.2-ab89fec50c3-20211206T162442Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).