diff options
author | René Scharfe <l.s.r@web.de> | 2023-06-17 23:41:44 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-18 22:55:30 +0300 |
commit | 44ccb337f10a08bb265b911f86deaf5f3347d967 (patch) | |
tree | 07762d77de4581021436c997e0f8099219f043b0 /strbuf.h | |
parent | 3c3d0c4242d834c49d77da321425819c175df61c (diff) |
strbuf: factor out strbuf_expand_step()
Extract the part of strbuf_expand that finds the next placeholder into a
new function. It allows to build parsers without callback functions and
the overhead imposed by them.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.h')
-rw-r--r-- | strbuf.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -372,6 +372,14 @@ size_t strbuf_expand_dict_cb(struct strbuf *sb, void *context); /** + * If the string pointed to by `formatp` contains a percent sign ("%"), + * advance it to point to the character following the next one and + * return 1, otherwise return 0. Append the substring before that + * percent sign to `sb`, or the whole string if there is none. + */ +int strbuf_expand_step(struct strbuf *sb, const char **formatp); + +/** * Append the contents of one strbuf to another, quoting any * percent signs ("%") into double-percents ("%%") in the * destination. This is useful for literal data to be fed to either |