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:42:26 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-18 22:55:30 +0300
commit39dbd49b4138b6cdc9fb73e317d4e9f06df0c5c5 (patch)
tree2b722043cd3649825a6cf80157d174135e251071 /strbuf.h
parent44ccb337f10a08bb265b911f86deaf5f3347d967 (diff)
replace strbuf_expand_dict_cb() with strbuf_expand_step()
Avoid the overhead of setting up a dictionary and passing it via strbuf_expand() to strbuf_expand_dict_cb() by using strbuf_expand_step() in a loop instead. It requires explicit handling of %% and unrecognized placeholders, but is more direct and simpler overall, and expands only on demand. 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.h14
1 files changed, 0 insertions, 14 deletions
diff --git a/strbuf.h b/strbuf.h
index a189f12b84..e293117f07 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -358,20 +358,6 @@ size_t strbuf_expand_literal_cb(struct strbuf *sb,
void *context);
/**
- * Used as callback for `strbuf_expand()`, expects an array of
- * struct strbuf_expand_dict_entry as context, i.e. pairs of
- * placeholder and replacement string. The array needs to be
- * terminated by an entry with placeholder set to NULL.
- */
-struct strbuf_expand_dict_entry {
- const char *placeholder;
- const char *value;
-};
-size_t strbuf_expand_dict_cb(struct strbuf *sb,
- const char *placeholder,
- 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