From: Junio C Hamano Date: Sat, 05 Jun 2010 18:07:19 GMT Subject: Re: [PATCH v2] optimize path_relative() Message-ID: <7vaar9z73c.fsf@alter.siamese.dyndns.org> In-Reply-To: <20100605073728.GA19159@localhost> Clemens Buchacher writes: > Avoid copying to strbuf in case a subset of the original string can > be returned. > > Since the strbuf is no longer guaranteed to be updated, this > function is different from quote_path_relative(). To avoid > confusion, do not export it. > > Signed-off-by: Clemens Buchacher The version of path_relative() after this patch looks much easier to follow. I noticed that there is a similar function write_name_quotedpfx() defined in the same file, and wondered if we can do something similar to avoid the whole allocation business. But that would only be a microoptimize useful for write_name_quoted_relative() and not for quote_path_relative() that has a lot more callers, so it would probably not be worth it. Thanks.