Re: [PATCH v2] optimize path_relative()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 5, 2010, 18:07 UTC
- Message-ID
- <7vaar9z73c.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20100605073728.GA19159@localhost>
Clemens Buchacher <drizzd@aon.at> writes:
Show 8 quoted lines
> 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 <drizzd@aon.at>
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.