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:
committed by
Junio C Hamano
parent
aba0706832
commit
787cb8a48a
@@ -508,7 +508,8 @@ static void fmt_tag_signature(struct strbuf *tagbuf,
|
||||
strbuf_complete_line(tagbuf);
|
||||
if (sig->len) {
|
||||
strbuf_addch(tagbuf, '\n');
|
||||
strbuf_add_commented_lines(tagbuf, sig->buf, sig->len);
|
||||
strbuf_add_commented_lines(tagbuf, sig->buf, sig->len,
|
||||
comment_line_char);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +555,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
|
||||
strbuf_addch(&tagline, '\n');
|
||||
strbuf_add_commented_lines(&tagline,
|
||||
origins.items[first_tag].string,
|
||||
strlen(origins.items[first_tag].string));
|
||||
strlen(origins.items[first_tag].string),
|
||||
comment_line_char);
|
||||
strbuf_insert(&tagbuf, 0, tagline.buf,
|
||||
tagline.len);
|
||||
strbuf_release(&tagline);
|
||||
@@ -562,7 +564,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
|
||||
strbuf_addch(&tagbuf, '\n');
|
||||
strbuf_add_commented_lines(&tagbuf,
|
||||
origins.items[i].string,
|
||||
strlen(origins.items[i].string));
|
||||
strlen(origins.items[i].string),
|
||||
comment_line_char);
|
||||
fmt_tag_signature(&tagbuf, &sig, buf, len);
|
||||
}
|
||||
strbuf_release(&payload);
|
||||
|
||||
Reference in New Issue
Block a user