Re: [PATCH] strbuf: add and use strbuf_insertstr()
On Sat, Feb 8, 2020 at 2:57 PM René Scharfe <l.s.r@web.de> wrote:
Show 13 quoted lines
> 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 <l.s.r@web.de>
> ---
> 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?