diff options
author | Jeff King <peff@peff.net> | 2024-03-12 05:17:15 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-12 13:28:09 -0700 |
commit | 3b45450db65b97f010420229457c529f69bb2168 (patch) | |
tree | e60154561ac4ca7c7d018a2bf31696705a874071 /builtin/commit.c | |
parent | db7f93093f2231a922c3d58e7ef5135168e7bb80 (diff) |
strbuf: avoid static variables in strbuf_add_commented_lines()
In strbuf_add_commented_lines(), we have to convert the single-byte
comment_line_char into a string to pass to add_lines(). We cache the
created string using a static-local variable. But this makes the
function non-reentrant, and it's doubtful that this provides any real
performance benefit given that we know the string always contains a
single character.
So let's just create it from scratch each time, and to give the compiler
the maximal opportunity to make it fast we'll ditch the over-complicated
xsnprintf() and just assign directly into the array.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions