Re: [PATCH 3/3] pretty=format: Avoid some expensive calculations when not needed
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 6, 2007, 01:06 UTC
- Message-ID
- <7vejf4kwry.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <472F7B2F.4050608@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 11 quoted lines
> Junio C Hamano schrieb: > ... >> Instead of allocating a separate array and freeing at the end, >> wouldn't it make more sense to have a bitfield that records what >> is used by the format string inside the array elements? > > How about (ab)using the value field? Let interp_find_active() mark > unneeded entries with NULL, and the rest with some cookie. All table > entries with non-NULL values need to be initialized. interp_set_entry() > needs to be aware of this cookie, as it mustn't free() it. The cookie > could be the address of a static char* in interpolate.c.
Sorry, where is this aversion to making the struct a bit larger coming from?