diff options
author | Jeff King <peff@peff.net> | 2024-03-12 10:17:37 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-12 21:28:10 +0100 |
commit | 600559b7169c1353e3d46f773f39cf018d38ebbc (patch) | |
tree | 140bfd7ddfd762cee4e25aec1e2d110645f3b998 /trailer.c | |
parent | prefer comment_line_str to comment_line_char for printing (diff) | |
download | git-600559b7169c1353e3d46f773f39cf018d38ebbc.tar.xz git-600559b7169c1353e3d46f773f39cf018d38ebbc.zip |
find multi-byte comment chars in NUL-terminated strings
Several parts of the code need to identify lines that begin with the
comment character, and do so with a simple byte equality check. As part
of the transition to handling multi-byte characters, we need to match
all of the bytes. For cases where we are looking in a NUL-terminated
string, we can just use starts_with(), which checks all of the
characters in comment_line_str.
Note that we can drop the "line.len" check in wt-status.c's
read_rebase_todolist(). The starts_with() function handles the case of
an empty haystack buffer (it will always return false for a non-empty
prefix).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r-- | trailer.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1013,7 +1013,7 @@ static void parse_trailers(struct trailer_info *info, for (i = 0; i < info->trailer_nr; i++) { int separator_pos; char *trailer = info->trailers[i]; - if (trailer[0] == comment_line_char) + if (starts_with(trailer, comment_line_str)) continue; separator_pos = find_separator(trailer, separators); if (separator_pos >= 1) { |