Optimize exclude: use hash tables for non-wildcard patterns.
authorSergey Poznyakoff <gray@gnu.org.ua>
Wed, 12 Aug 2009 16:03:07 +0000 (19:03 +0300)
committerSergey Poznyakoff <gray@gnu.org.ua>
Wed, 12 Aug 2009 16:06:21 +0000 (19:06 +0300)
commitf28a2482feb7b5870dea9c7fb895622cdca5bd30
tree76fc4bfa925b3b4b2366e3c18db235d8db82f29a
parentb8d582b51ab6f7221d3f0d7da93a5aee5dd85b3c
Optimize exclude: use hash tables for non-wildcard patterns.

* lib/exclude.c: Include hash.h and mbuiter.h
(struct exclude_pattern, exclude_segment): New data types.
(struct exclude): Rewrite.
(fnmatch_pattern_has_wildcards): New function.
(new_exclude_segment, free_exclude_segment): New functions.
(excluded_file_pattern_p, excluded_file_name_p): New functions.
(excluded_file_name, add_exclude): Rewrite using new struct exclude.
* lib/exclude.h (is_fnmatch_pattern): New prototype.
* modules/exclude: Depend on hash and mbuiter.

* modules/exclude-tests: New file.
* tests/test-exclude.c: New file.
* tests/test-exclude1.sh: New file.
* tests/test-exclude2.sh: New file.
* tests/test-exclude3.sh: New file.
* tests/test-exclude4.sh: New file.
* tests/test-exclude5.sh: New file.
* tests/test-exclude6.sh: New file.
* tests/test-exclude7.sh: New file.
12 files changed:
lib/exclude.c
lib/exclude.h
modules/exclude
modules/exclude-tests [new file with mode: 0644]
tests/test-exclude.c [new file with mode: 0644]
tests/test-exclude1.sh [new file with mode: 0755]
tests/test-exclude2.sh [new file with mode: 0755]
tests/test-exclude3.sh [new file with mode: 0755]
tests/test-exclude4.sh [new file with mode: 0755]
tests/test-exclude5.sh [new file with mode: 0755]
tests/test-exclude6.sh [new file with mode: 0755]
tests/test-exclude7.sh [new file with mode: 0755]