From: Eric Sunshine Date: Sun, 09 Feb 2020 00:53:03 GMT Subject: Re: [PATCH] strbuf: add and use strbuf_insertstr() Message-ID: In-Reply-To: <019be197-e0aa-1234-e16f-6561d8340023@web.de> On Sat, Feb 8, 2020 at 2:57 PM René Scharfe wrote: > Add a function for inserting a C string into a strbuf. Use it > throughout the source to get rid of magic string length constants and > explicit strlen() calls. > > Like strbuf_addstr(), implement it as an inline function to avoid the > implicit strlen() calls to cause runtime overhead. > > Signed-off-by: René Scharfe > --- > diff --git a/notes-utils.c b/notes-utils.c > @@ -52,7 +52,7 @@ void commit_notes(struct repository *r, struct notes_tree *t, const char *msg) > - strbuf_insert(&buf, 0, "notes: ", 7); /* commit message starts at index 7 */ > + strbuf_insertstr(&buf, 0, "notes: "); /* commit message starts at index 7 */ Is there a reason to retain the comment which talks about magic number 7?