On Sat, Jun 17, 2023 at 10:42:26PM +0200, René Scharfe wrote: > 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. Great. I think even replacing the dictionary with regular strbuf_expand() would be an improvement in terms of the on-demand loading. But I am happy to see it go all the way to the iterative version. :) Your comment above does make me wonder if strbuf_expand_step() should be quietly handling "%%" itself. But I guess strbuf_expand() doesn't, and your branch.c quote-literal example probably would not want that behavior. -Peff