From: Jeff King Date: Tue, 27 Jun 2023 08:29:02 GMT Subject: Re: [PATCH 3/5] replace strbuf_expand_dict_cb() with strbuf_expand_step() Message-ID: <20230627082902.GI1226768@coredump.intra.peff.net> In-Reply-To: <5ce9513b-d463-6f62-db4e-f9f60a7c3e9f@web.de> 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