Subject: [PATCH 00/25] grep: PCREv2 fixes, remove kwset.[ch]

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 3 Feb 2021 04:27:46 +0100

This is based on next. I was wondering if/how to split this up, it
should arguably be a few serieses, but let's see if it gets some
traction in reviews like this. Comments below:

Ævar Arnfjörð Bjarmason (25):
  grep/pcre2 tests: reword comments referring to kwset
  grep/pcre2: drop needless assignment + assert() on opt->pcre2
  grep/pcre2: drop needless assignment to NULL
  grep/pcre2: correct reference to grep_init() in comment
  grep/pcre2: prepare to add debugging to pcre2_malloc()
  grep/pcre2: add GREP_PCRE2_DEBUG_MALLOC debug mode
  grep/pcre2: use compile-time PCREv2 version test
  grep/pcre2: use pcre2_maketables_free() function
  grep/pcre2: actually make pcre2 use custom allocator
  grep/pcre2: move back to thread-only PCREv2 structures
  grep/pcre2: move definitions of pcre2_{malloc,free}

PCRE v2 code cleanups, and fix up bugs in our pcre2_{malloc,free}()
handling.

  pickaxe tests: refactor to use test_commit --append
  pickaxe -S: support content with NULs under --pickaxe-regex
  pickaxe -S: remove redundant "sz" check in while-loop
  pickaxe/style: consolidate declarations and assignments
  pickaxe tests: add test for diffgrep_consume() internals
  pickaxe tests: add test for "log -S" not being a regex
  perf: add performance test for pickaxe

Various test prep for pickaxe.

  pickaxe -G: set -U0 for diff generation

Turns out feeding "log -G" -U10 output makes it faster.

  grep.h: make patmatch() a public function
  pickaxe: use PCREv2 for -G and -S
  Remove unused kwset.[ch]

At long last, kwset.[ch] is gone!

  xdiff-interface: allow early return from xdiff_emit_{line,hunk}_fn
  xdiff-interface: support early exit in xdiff_outf()
  pickaxe -G: terminate early on matching lines

Solve an ancient todo item in pickaxe by extending our xdiff interface
so you can early exit from hunk/line handlers.

 Makefile                       |   2 -
 builtin/grep.c                 |   1 -
 combine-diff.c                 |   9 +-
 compat/obstack.c               | 413 ------------------
 compat/obstack.h               | 511 ----------------------
 ctype.c                        |  36 --
 diff.c                         |  39 +-
 diff.h                         |   4 +
 diffcore-pickaxe.c             | 184 ++++----
 git-compat-util.h              |   3 -
 grep.c                         | 103 ++---
 grep.h                         |  11 +-
 kwset.c                        | 775 ---------------------------------
 kwset.h                        |  65 ---
 range-diff.c                   |   8 +-
 t/perf/p4209-pickaxe.sh        |  82 ++++
 t/t4209-log-pickaxe.sh         |  64 ++-
 t/t7816-grep-binary-pattern.sh |   4 +-
 xdiff-interface.c              |  26 +-
 xdiff-interface.h              |  36 +-
 20 files changed, 351 insertions(+), 2025 deletions(-)
 delete mode 100644 compat/obstack.c
 delete mode 100644 compat/obstack.h
 delete mode 100644 kwset.c
 delete mode 100644 kwset.h
 create mode 100755 t/perf/p4209-pickaxe.sh

-- 
2.30.0.284.gd98b1dd5eaa7