summaryrefslogtreecommitdiff
path: root/bootstrap.conf
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-09-07 17:20:11 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-09-07 19:49:33 -0700
commit33e4602c96e639ec7d56b92ffe3614aa700d3d76 (patch)
treedd2a886a01d60d2ea22a2eade588ff6a8dc3bc53 /bootstrap.conf
parent7ded8efd721ce2abf2b781931e0a0bdd46b156d7 (diff)
downloadgrep-33e4602c96e639ec7d56b92ffe3614aa700d3d76.tar.gz
Omit duplicate regexps
Do not pass two copies of the same regexp to the regular-expression engine. Although the engines should perform nearly as well even with the copies, in practice they do not. Problem reported by Luca Borzacchiello (Bug#43040). * bootstrap.conf (gnulib_modules): Add hash. * src/grep.c: Include stdint.h, for SIZE_WIDTH. Include hash.h. (struct patloc, patloc, patlocs_allocated, patlocs_used): Rename from struct FL_pair, fl_pair, n_fl_pair_slots, n_pattern_files, respectively, since the data type is no longer a pair. All uses changed. (struct patloc): New member FILELINE. The lineno member is now ptrdiff_t since nowadays we prefer signed types. (pattern_array, patterns_table): New static vars. (count_nl_bytes, fl_add): Remove; no longer used. (hash_pattern, compare_patterns, update_patterns): New functions. update_patterns does what fl_add used to do, plus remove dups. (pattern_file_name): Adjust to change from fl_pair to patloc. (main): Move some variables to inner blocks for clarity. Maintain the pattern_table hash of all patterns. Update pattern_array to match keys, and use update_patterns instead of fl_add to remove duplicate keys. * tests/filename-lineno.pl (invalid-re-2-files) (invalid-re-2-files2, invalid-re-2e): Ensure regexps are unique in tests so that dups aren’t removed in diagnostics. (invalid-re-line-numbers): New test.
Diffstat (limited to 'bootstrap.conf')
-rw-r--r--bootstrap.conf1
1 files changed, 1 insertions, 0 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index ef142fcd..fceb3188 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -49,6 +49,7 @@ git-version-gen
gitlog-to-changelog
gnu-web-doc-update
gnupload
+hash
ignore-value
intprops
inttypes