From e36091aa1d67cedba02ea9de9245f0ff14a52f15 Mon Sep 17 00:00:00 2001 From: René Scharfe Date: Sun, 24 Mar 2024 12:19:40 +0100 Subject: factor out strbuf_expand_bad_format() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extract a function for reporting placeholders that are not enclosed in a parenthesis or are unknown. This reduces the number of strings to translate and improves consistency across commands. Call it at the end of the if/else chain, after exhausting all accepted possibilities. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- strbuf.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'strbuf.h') diff --git a/strbuf.h b/strbuf.h index e959caca87..c758de3729 100644 --- a/strbuf.h +++ b/strbuf.h @@ -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 -- cgit v1.3