diff options
author | Bruno Haible <bruno@clisp.org> | 2018-06-25 21:45:23 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-06-25 21:45:23 +0200 |
commit | d7cf3b8d27f6b7ccbcdcdd9d18d7e12208795e3d (patch) | |
tree | 382e97c6a19bbd00c4257093416a97b9619a3119 /lib/exclude.c | |
parent | fcdf335e093e245e384874254ec897c97430ccf2 (diff) | |
download | gnulib-d7cf3b8d27f6b7ccbcdcdd9d18d7e12208795e3d.tar.gz |
Continue to use spaces for indentation, not tabs.
Diffstat (limited to 'lib/exclude.c')
-rw-r--r-- | lib/exclude.c | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/lib/exclude.c b/lib/exclude.c index 993be74cc7..88f81879e8 100644 --- a/lib/exclude.c +++ b/lib/exclude.c @@ -146,20 +146,20 @@ fnmatch_pattern_has_wildcards (const char *str, int options) { switch (*str++) { - case '.': - case '{': - case '}': - case '(': - case ')': - if (options & EXCLUDE_REGEX) - return true; - break; + case '.': + case '{': + case '}': + case '(': + case ')': + if (options & EXCLUDE_REGEX) + return true; + break; case '\\': - if (options & EXCLUDE_REGEX) - continue; - else - str += ! (options & FNM_NOESCAPE) && *str; + if (options & EXCLUDE_REGEX) + continue; + else + str += ! (options & FNM_NOESCAPE) && *str; break; case '+': case '@': case '!': @@ -287,10 +287,10 @@ free_exclude_segment (struct exclude_segment *seg) { case exclude_pattern: for (i = 0; i < seg->v.pat.exclude_count; i++) - { - if (seg->v.pat.exclude[i].options & EXCLUDE_REGEX) - regfree (&seg->v.pat.exclude[i].v.re); - } + { + if (seg->v.pat.exclude[i].options & EXCLUDE_REGEX) + regfree (&seg->v.pat.exclude[i].v.re); + } free (seg->v.pat.exclude); break; @@ -387,7 +387,7 @@ exclude_fnmatch (char const *pattern, char const *f, int options) if (! (options & EXCLUDE_ANCHORED)) for (p = f; *p && ! matched; p++) if (*p == '/' && p[1] != '/') - matched = ((*matcher) (pattern, p + 1, options) == 0); + matched = ((*matcher) (pattern, p + 1, options) == 0); return matched; } @@ -525,9 +525,9 @@ add_exclude (struct exclude *ex, char const *pattern, int options) && fnmatch_pattern_has_wildcards (pattern, options)) { if (! (ex->head && ex->head->type == exclude_pattern - && ((ex->head->options & EXCLUDE_INCLUDE) - == (options & EXCLUDE_INCLUDE)))) - new_exclude_segment (ex, exclude_pattern, options); + && ((ex->head->options & EXCLUDE_INCLUDE) + == (options & EXCLUDE_INCLUDE)))) + new_exclude_segment (ex, exclude_pattern, options); seg = ex->head; @@ -539,48 +539,48 @@ add_exclude (struct exclude *ex, char const *pattern, int options) patopts->options = options; if (options & EXCLUDE_REGEX) - { - int rc; - int cflags = REG_NOSUB|REG_EXTENDED| - ((options & FNM_CASEFOLD) ? REG_ICASE : 0); - - if (options & FNM_LEADING_DIR) - { - char *tmp; - size_t len = strlen (pattern); - - while (len > 0 && ISSLASH (pattern[len-1])) - --len; - - if (len == 0) - rc = 1; - else - { - tmp = xmalloc (len + 7); - memcpy (tmp, pattern, len); - strcpy (tmp + len, "(/.*)?"); - rc = regcomp (&patopts->v.re, tmp, cflags); - free (tmp); - } - } - else - rc = regcomp (&patopts->v.re, pattern, cflags); - - if (rc) - { - pat->exclude_count--; - return; - } - } + { + int rc; + int cflags = REG_NOSUB|REG_EXTENDED| + ((options & FNM_CASEFOLD) ? REG_ICASE : 0); + + if (options & FNM_LEADING_DIR) + { + char *tmp; + size_t len = strlen (pattern); + + while (len > 0 && ISSLASH (pattern[len-1])) + --len; + + if (len == 0) + rc = 1; + else + { + tmp = xmalloc (len + 7); + memcpy (tmp, pattern, len); + strcpy (tmp + len, "(/.*)?"); + rc = regcomp (&patopts->v.re, tmp, cflags); + free (tmp); + } + } + else + rc = regcomp (&patopts->v.re, pattern, cflags); + + if (rc) + { + pat->exclude_count--; + return; + } + } else - { - if (options & EXCLUDE_ALLOC) - { - pattern = xstrdup (pattern); - exclude_add_pattern_buffer (ex, (char*) pattern); - } - patopts->v.pattern = pattern; - } + { + if (options & EXCLUDE_ALLOC) + { + pattern = xstrdup (pattern); + exclude_add_pattern_buffer (ex, (char*) pattern); + } + patopts->v.pattern = pattern; + } } else { @@ -609,9 +609,9 @@ add_exclude (struct exclude *ex, char const *pattern, int options) int add_exclude_fp (void (*add_func) (struct exclude *, char const *, int, void *), - struct exclude *ex, FILE *fp, int options, - char line_end, - void *data) + struct exclude *ex, FILE *fp, int options, + char line_end, + void *data) { char *buf = NULL; char *p; @@ -674,8 +674,8 @@ call_addfn (struct exclude *ex, char const *pattern, int options, void *data) int add_exclude_file (void (*add_func) (struct exclude *, char const *, int), - struct exclude *ex, char const *file_name, int options, - char line_end) + struct exclude *ex, char const *file_name, int options, + char line_end) { bool use_stdin = file_name[0] == '-' && !file_name[1]; FILE *in; |