Hi, On Thu, 8 Sep 2016, Johannes Schindelin wrote: > The new regexec_buf() function operates on buffers with an explicitly > specified length, rather than NUL-terminated strings. > > We need to use this function whenever the buffer we want to pass to > regexec() may have been mmap()ed (and is hence not NUL-terminated). > > Note: the original motivation for this patch was to fix a bug where > `git diff -G <regex>` would crash. This patch converts more callers, > though, some of which explicitly allocated and constructed > NUL-terminated strings (or worse: modified read-only buffers to insert > NULs). > > Some of the buffers actually may be NUL-terminated. As regexec_buf() > uses REG_STARTEND where available, but has to fall back to allocating > and constructing NUL-terminated strings where REG_STARTEND is not > available, this makes the code less efficient in the latter case. > > However, given the widespread support for REG_STARTEND, combined with > the improved ease of code maintenance, we strike the balance in favor > of REG_STARTEND. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> > --- > diff.c | 3 ++- > diffcore-pickaxe.c | 18 ++++++++---------- > xdiff-interface.c | 13 ++++--------- > 3 files changed, 14 insertions(+), 20 deletions(-) I just realized that this should switch the test_expect_failure from 1/3 to a test_expect_success. Will send out v3 in a moment. Ciao, Dscho