From 037de004c68d704abf839eebe075c58c9603f8f3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 20 May 2024 07:14:36 +0200 Subject: Adding upstream version 1:2.45.1. Signed-off-by: Daniel Baumann --- strbuf.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'strbuf.h') diff --git a/strbuf.h b/strbuf.h index e959cac..97fa4a3 100644 --- a/strbuf.h +++ b/strbuf.h @@ -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); + const char *comment_prefix); /** @@ -337,6 +337,11 @@ size_t strbuf_expand_literal(struct strbuf *sb, const char *placeholder); */ int strbuf_expand_step(struct strbuf *sb, const char **formatp); +/** + * Used with `strbuf_expand_step` to report unknown placeholders. + */ +void strbuf_expand_bad_format(const char *format, const char *command); + /** * Append the contents of one strbuf to another, quoting any * percent signs ("%") into double-percents ("%%") in the @@ -379,7 +384,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, const 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 +518,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-NULL, * 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, const char *comment_prefix); static inline int strbuf_strip_suffix(struct strbuf *sb, const char *suffix) { @@ -673,6 +678,7 @@ char *xstrfmt(const char *fmt, ...); int starts_with(const char *str, const char *prefix); int istarts_with(const char *str, const char *prefix); +int starts_with_mem(const char *str, size_t len, const char *prefix); /* * If the string "str" is the same as the string in "prefix", then the "arg" -- cgit v1.2.3