diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2008-11-23 00:09:30 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-23 19:55:47 -0800 |
commit | 9b864e730bda0e028a85387fa568429724582f22 (patch) | |
tree | d7c43e556e2e2d7955a39c83bcb9e5e4d147ef0e /Documentation/technical | |
parent | git-commit.txt - mention that files listed on the command line must be known ... (diff) | |
download | tgif-9b864e730bda0e028a85387fa568429724582f22.tar.xz |
add strbuf_expand_dict_cb(), a helper for simple cases
The new callback function strbuf_expand_dict_cb() can be used together
with strbuf_expand() if there is only a small number of placeholders
for static replacement texts. It expects its dictionary as an array of
placeholder+value pairs as context parameter, terminated by an entry
with the placeholder member set to NULL.
The new helper is intended to aid converting the remaining calls of
interpolate(). strbuf_expand() is smaller, more flexible and can be
used to go faster than interpolate(), so it should replace the latter.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical')
-rw-r--r-- | Documentation/technical/api-strbuf.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index a9668e5f2d..a8ee2fe6a1 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -205,6 +205,13 @@ In order to facilitate caching and to make it possible to give parameters to the callback, `strbuf_expand()` passes a context pointer, which can be used by the programmer of the callback as she sees fit. +`strbuf_expand_dict_cb`:: + + 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. + `strbuf_addf`:: Add a formatted string to the buffer. |