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:43:17 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-18 22:55:30 +0300
commit6f1e2d52797161c7effe4d1388765de3dbd80bbf (patch)
treef00abffad5e1956a300923be11f2ba8ef2f53d1d /strbuf.c
parent39dbd49b4138b6cdc9fb73e317d4e9f06df0c5c5 (diff)
replace strbuf_expand() with strbuf_expand_step()
Avoid the overhead of passing context to a callback function of strbuf_expand() by using strbuf_expand_step() in a loop instead. It requires explicit handling of %% and unrecognized placeholders, but is simpler, more direct and avoids void pointers. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/strbuf.c b/strbuf.c
index 972366b410..c3d1cee616 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -427,26 +427,6 @@ int strbuf_expand_step(struct strbuf *sb, const char **formatp)
return 1;
}
-void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,
- void *context)
-{
- while (strbuf_expand_step(sb, &format)) {
- size_t consumed;
-
- if (*format == '%') {
- strbuf_addch(sb, '%');
- format++;
- continue;
- }
-
- consumed = fn(sb, format, context);
- if (consumed)
- format += consumed;
- else
- strbuf_addch(sb, '%');
- }
-}
-
size_t strbuf_expand_literal_cb(struct strbuf *sb,
const char *placeholder,
void *context UNUSED)