diff options
author | Jeff King <peff@peff.net> | 2024-03-12 10:17:22 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-12 21:28:10 +0100 |
commit | 2786d058b6b25ab5f8d0994d24f4f4dc9442a41a (patch) | |
tree | 81a4c65780e0c9b8332000d429a53f343b5d8e35 /strbuf.h | |
parent | commit: refactor base-case of adjust_comment_line_char() (diff) | |
download | git-2786d058b6b25ab5f8d0994d24f4f4dc9442a41a.tar.xz git-2786d058b6b25ab5f8d0994d24f4f4dc9442a41a.zip |
strbuf: avoid shadowing global comment_line_char name
Several comment-related strbuf functions take a comment_line_char
parameter. There's also a global comment_line_char variable, which is
closely related (most callers pass it in as this parameter). Let's avoid
shadowing the global name. This makes it more obvious that we're not
using the global value, and it will be especially helpful as we refactor
the global in future patches (in particular, any macro trickery wouldn't
work because the preprocessor doesn't respect scope).
We'll use "comment_prefix". That should be descriptive enough, and as a
bonus is more neutral with respect to the "char" type (since we'll
eventually swap it out for a string).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r-- | strbuf.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -288,7 +288,7 @@ void strbuf_splice(struct strbuf *sb, size_t pos, size_t len, */ void strbuf_add_commented_lines(struct strbuf *out, const char *buf, size_t size, - char comment_line_char); + char comment_prefix); /** @@ -379,7 +379,7 @@ void strbuf_addf(struct strbuf *sb, const char *fmt, ...); * blank to the buffer. */ __attribute__((format (printf, 3, 4))) -void strbuf_commented_addf(struct strbuf *sb, char comment_line_char, const char *fmt, ...); +void strbuf_commented_addf(struct strbuf *sb, char comment_prefix, const char *fmt, ...); __attribute__((format (printf,2,0))) void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap); @@ -513,11 +513,11 @@ int strbuf_getcwd(struct strbuf *sb); int strbuf_normalize_path(struct strbuf *sb); /** - * Strip whitespace from a buffer. If comment_line_char is non-NUL, + * Strip whitespace from a buffer. If comment_prefix is non-NUL, * then lines beginning with that character are considered comments, * thus removed. */ -void strbuf_stripspace(struct strbuf *buf, char comment_line_char); +void strbuf_stripspace(struct strbuf *buf, char comment_prefix); static inline int strbuf_strip_suffix(struct strbuf *sb, const char *suffix) { |