diff options
author | Calvin Wan <calvinwan@google.com> | 2023-06-06 22:48:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-12 23:49:36 +0300 |
commit | 787cb8a48ae24ff07fa7c763909bb204bfdc84a7 (patch) | |
tree | 3f5081154dbc5b8fedb73cac218d581065637bcc /wt-status.c | |
parent | aba070683295a20bdf4f49146384984961c794b2 (diff) |
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>
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wt-status.c b/wt-status.c index 068b76ef6d..677465b10c 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1024,7 +1024,7 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom if (s->display_comment_prefix) { size_t len; summary_content = strbuf_detach(&summary, &len); - strbuf_add_commented_lines(&summary, summary_content, len); + strbuf_add_commented_lines(&summary, summary_content, len, comment_line_char); free(summary_content); } @@ -1099,8 +1099,8 @@ void wt_status_append_cut_line(struct strbuf *buf) { const char *explanation = _("Do not modify or remove the line above.\nEverything below it will be ignored."); - strbuf_commented_addf(buf, "%s", cut_line); - strbuf_add_commented_lines(buf, explanation, strlen(explanation)); + strbuf_commented_addf(buf, comment_line_char, "%s", cut_line); + strbuf_add_commented_lines(buf, explanation, strlen(explanation), comment_line_char); } void wt_status_add_cut_line(FILE *fp) |