]> Savannah Git Hosting - gnulib.git/commit
exclude: add support for posix regexps
authorSergey Poznyakoff <gray@gnu.org.ua>
Sat, 15 Feb 2014 17:21:04 +0000 (19:21 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Fri, 21 Feb 2014 15:35:26 +0000 (17:35 +0200)
commit24b8e0622053e4772eddba3bfba48c2928321cec
tree2864de77e5bc1b357a1d1c4244035197342275a2
parent3f51bf41c8be8b310f57caff371377414701d5cc
exclude: add support for posix regexps

This commit adds support for POSIX extended regular expressions
and fixes a long-standing memory leak (pattern buffer was never
freed).  It also implements a new interface function to read
exclude patterns from a FILE, which passes an additional parameter
to its callback function, thereby allowing to preserve its state
between invocations.

* lib/exclude.c (struct patopts): Pack regex and pattern into union.
(pattern_buffer): New struct.
(exclude): New member patbuf.
(exclude_add_pattern_buffer): New function.
(free_exclude_segment): Free regexps.
(free_exclude): Free allocated pattern buffers.
(exclude_patopts): New function.
(file_pattern_matches): Use exclude_patopts.
(add_exclude): support regexps.
(add_exclude_fp): New function.
(add_exclude_file): Rewrite using add_exclude_fp.
(fnmatch_pattern_has_wildcards): Support posix extended regexps.
* lib/exclude.h (EXCLUDE_REGEX, EXCLUDE_ALLOC): New flags.
(add_exclude_fp)
(exclude_add_pattern_buffer): New prototypes.
* modules/exclude: Depends on regex and filename.
ChangeLog
lib/exclude.c
lib/exclude.h
modules/exclude