path: root/strbuf.h
diff options
authorMarco Costalba <>2008-02-09 14:40:19 (GMT)
committerJunio C Hamano <>2008-02-10 07:57:08 (GMT)
commitc3a670de50589dedf2d9b83305e8bd0ff63a1a60 (patch)
tree303820b577a8d046a0cddddd9fbc58bd362c529d /strbuf.h
parent053d9e432be246a389fb8adaa0c88e7c791f8b21 (diff)
Avoid a useless prefix lookup in strbuf_expand()
Currently, the --pretty=format prefix is looked up in a tight loop in strbuf_expand(), if prefix is found it is then used as argument for format_commit_item() that does another search by a switch statement to select the proper operation. Because the switch statement is already able to discard unknown matches we don't need the prefix lookup before to call format_commit_item(). Signed-off-by: Marco Costalba <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'strbuf.h')
1 files changed, 2 insertions, 2 deletions
diff --git a/strbuf.h b/strbuf.h
index 36d61db..faec229 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -103,8 +103,8 @@ static inline void strbuf_addbuf(struct strbuf *sb, struct strbuf *sb2) {
extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len);
-typedef void (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context);
-extern void strbuf_expand(struct strbuf *sb, const char *format, const char **placeholders, expand_fn_t fn, void *context);
+typedef size_t (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context);
+extern void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn, void *context);
extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);