[PATCH v11 00/10] grep: simplify & delete "init" & "config" code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This series makes using the grep.[ch] API easier, by having it follow
the usual pattern of being initialized with:

    defaults -> config -> command-line

This is to make some follow-up work easier, this is a net code
deletion if we exclude newly added tests.

Changes since v9:

  * A new 3/10 and 4/10 hopefully address the comments about the test
    code. I ended up just adding a helper to reduce the existing and
    new verbosity of the tests, which should make it easier to reason
    about them.

Ævar Arnfjörð Bjarmason (10):
  grep.h: remove unused "regex_t regexp" from grep_opt
  log tests: check if grep_config() is called by "log"-like cmds
  grep tests: create a helper function for "BRE" or "ERE"
  grep tests: add missing "grep.patternType" config tests
  built-ins: trust the "prefix" from run_builtin()
  grep.c: don't pass along NULL callback value
  grep API: call grep_config() after grep_init()
  grep.h: make "grep_opt.pattern_type_option" use its enum
  grep.c: do "if (bool && memchr())" not "if (memchr() && bool)"
  grep: simplify config parsing and option parsing

 builtin/grep.c    |  27 +++----
 builtin/log.c     |  13 +++-
 builtin/ls-tree.c |   2 +-
 git.c             |   1 +
 grep.c            | 113 ++++------------------------
 grep.h            |  31 ++++++--
 revision.c        |   4 +-
 t/t4202-log.sh    |  24 ++++++
 t/t7810-grep.sh   | 186 ++++++++++++++++++++++++++--------------------
 9 files changed, 195 insertions(+), 206 deletions(-)

Range-diff against v10:
 1:  184f7e0c5bd =  1:  67af9123727 grep.h: remove unused "regex_t regexp" from grep_opt
 2:  ac397cc6a18 =  2:  b275d23f0a8 log tests: check if grep_config() is called by "log"-like cmds
 3:  3464c76cfd7 <  -:  ----------- grep tests: add missing "grep.patternType" config tests
 -:  ----------- >  3:  b0f91bf7e4a grep tests: create a helper function for "BRE" or "ERE"
 -:  ----------- >  4:  9906edd4f58 grep tests: add missing "grep.patternType" config tests
 4:  c6ada96298a =  5:  7389f767388 built-ins: trust the "prefix" from run_builtin()
 5:  1f09de53e07 =  6:  38bfa0ed5f9 grep.c: don't pass along NULL callback value
 6:  ce646154538 =  7:  a4c1ee91dc9 grep API: call grep_config() after grep_init()
 7:  6446b4f0f33 =  8:  fa0da3a9fba grep.h: make "grep_opt.pattern_type_option" use its enum
 8:  df8ba5aba68 =  9:  243ceccc1ad grep.c: do "if (bool && memchr())" not "if (memchr() && bool)"
 9:  ccbdfa48315 = 10:  38bc5dc9461 grep: simplify config parsing and option parsing
-- 
2.35.1.1028.g9479bb34b83




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux