Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 16, 2015, 18:13 UTC
- Message-ID
- <xmqqpp1iqlke.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20150916102524.GA28002@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> + free(file);
> + file = xstrfmt("%s/%s", maildir, list.items[i].string);Repeated pattern makes one wonder if a thin wrapper
xstrfmt_to(&file, "%s/%s", maildir, list.items[i].string);
that first frees the existing value and then overwrites is an overall win. Perhaps not, as you would (1) initialize the variable to NULL before doing a series of xstrfmt_to(), and (2) free the final one yourself.