From fd2015b323d283c73346d70d2285a927650bb60a Mon Sep 17 00:00:00 2001 From: Anders Waldenborg Date: Mon, 28 Jan 2019 22:33:36 +0100 Subject: strbuf: separate callback for strbuf_expand:ing literals Expanding '%n' and '%xNN' is generic functionality, so extract that from the pretty.c formatter into a callback that can be reused. No functional change intended Signed-off-by: Anders Waldenborg Signed-off-by: Junio C Hamano --- strbuf.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'strbuf.h') diff --git a/strbuf.h b/strbuf.h index fc40873b65..52e44c9ab8 100644 --- a/strbuf.h +++ b/strbuf.h @@ -320,6 +320,14 @@ void strbuf_expand(struct strbuf *sb, expand_fn_t fn, void *context); +/** + * Used as callback for `strbuf_expand` to only expand literals + * (i.e. %n and %xNN). The context argument is ignored. + */ +size_t strbuf_expand_literal_cb(struct strbuf *sb, + const char *placeholder, + void *context); + /** * Used as callback for `strbuf_expand()`, expects an array of * struct strbuf_expand_dict_entry as context, i.e. pairs of -- cgit v1.3-5-g45d5