view modules/exclude @ 17614:ab0ca58c72b1

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.
author Sergey Poznyakoff <gray@gnu.org.ua>
date Sat, 15 Feb 2014 19:21:04 +0200
parents d7e9b7baad5b
children
line wrap: on
line source

Description:
Manage list of filenames or wildcard patterns for --exclude option processing.

Files:
lib/exclude.h
lib/exclude.c

Depends-on:
filename
fnmatch
hash
mbscasecmp
mbuiter
regex
stdbool
verify
xalloc

configure.ac:

Makefile.am:
lib_SOURCES += exclude.c

Include:
"exclude.h"

License:
GPL

Maintainer:
Paul Eggert