Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2023-06-17 23:41:44 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-18 22:55:30 +0300
commit44ccb337f10a08bb265b911f86deaf5f3347d967 (patch)
tree07762d77de4581021436c997e0f8099219f043b0 /strbuf.h
parent3c3d0c4242d834c49d77da321425819c175df61c (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.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index 3dfeadb44c..a189f12b84 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -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