Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 7, 2016, 18:31 UTC
- Message-ID
- <xmqqinu7muic.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160906184143.55a5zoa2mj6c2e5m@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> What happens to those poor souls on systems without REG_STARTEND? Do > they get to keep segfaulting? > > I think the solution is to push them into setting NO_REGEX. So looking > at this versus a "regexecn", it seems: > > - this lets people keep using their native regexec if it supports > STARTEND > > - this is a bit more clunky to use at the callsites (though we could > _create_ a portable regexecn wrapper that uses this technique on top > of the native regex library) > > But I much prefer this approach to copying the data just to add a NUL.
I first thought "push them to NO_REGEX" to mean "they live with crippled Git that does not do regexp" and went "Huh?", but it merely means "let's avoid platform regex library and use on from the compat/ hierarchy", which would solve the STARTEND portability issue for everybody.
Which is very good.
The idea to create a thin regexecn() wrapper also sounds like a good idea, too. The changes to the callsites in the demonstration patch does look a bit clunky to me, too.