strbuf: remove global variable

As a library that only interacts with other primitives, strbuf should
not utilize the comment_line_char global variable within its
functions. Therefore, add an additional parameter for functions that use
comment_line_char and refactor callers to pass it in instead.
strbuf_stripspace() removes the skip_comments boolean and checks if
comment_line_char is a non-NUL character to determine whether to skip
comments or not.

Signed-off-by: Calvin Wan <calvinwan@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Calvin Wan
2023-06-06 19:48:43 +00:00
committed by Junio C Hamano
parent aba0706832
commit 787cb8a48a
16 changed files with 90 additions and 64 deletions

View File

@ -13,6 +13,7 @@
#include "tempfile.h"
#include "alias.h"
#include "wrapper.h"
#include "environment.h"
static int git_gpg_config(const char *, const char *, void *);
@ -586,8 +587,8 @@ static int verify_ssh_signed_buffer(struct signature_check *sigc,
}
}
strbuf_stripspace(&ssh_keygen_out, 0);
strbuf_stripspace(&ssh_keygen_err, 0);
strbuf_stripspace(&ssh_keygen_out, '\0');
strbuf_stripspace(&ssh_keygen_err, '\0');
/* Add stderr outputs to show the user actual ssh-keygen errors */
strbuf_add(&ssh_keygen_out, ssh_principals_err.buf, ssh_principals_err.len);
strbuf_add(&ssh_keygen_out, ssh_keygen_err.buf, ssh_keygen_err.len);