X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/5e972dcf34df59af1ba5ffd91b6ca278de22b847..2c713fcdfa04eb7d58c67a4a51d4cbdc37f78536:/exclude.c diff --git a/exclude.c b/exclude.c index 78d9c8ce..8dab79fe 100644 --- a/exclude.c +++ b/exclude.c @@ -84,14 +84,14 @@ static void make_exclude(struct exclude_list_struct *listp, const char *pat, for (cp = ret->pattern; (cp = strchr(cp, '/')) != NULL; cp++) ret->slash_cnt++; + ret->match_flags = mflags; + if (!listp->tail) listp->head = listp->tail = ret; else { listp->tail->next = ret; listp->tail = ret; } - - ret->match_flags = mflags; } static void free_exclude(struct exclude_struct *ex) @@ -100,7 +100,7 @@ static void free_exclude(struct exclude_struct *ex) free(ex); } -void free_exclude_list(struct exclude_list_struct *listp) +void clear_exclude_list(struct exclude_list_struct *listp) { struct exclude_struct *ent, *next; @@ -235,10 +235,9 @@ int check_exclude(struct exclude_list_struct *listp, char *name, int name_is_dir /* Get the next include/exclude arg from the string. The token will not * be '\0' terminated, so use the returned length to limit the string. * Also, be sure to add this length to the returned pointer before passing - * it back to ask for the next token. This routine will not parse the +/- - * prefixes or the "!" token when xflags contains XFLG_WORDS_ONLY. The - * *incl_ptr value will be 1 for an include, 0 for an exclude, and -1 for - * the list-clearing "!" token. + * it back to ask for the next token. This routine parses the +/- prefixes + * and the "!" token unless xflags contains XFLG_WORDS_ONLY. The *flag_ptr + * value will also be set to the MATCHFLG_* bits for the current token. */ static const char *get_exclude_tok(const char *p, unsigned int *len_ptr, unsigned int *flag_ptr, int xflags) @@ -303,7 +302,7 @@ void add_exclude(struct exclude_list_struct *listp, const char *pattern, "[%s] clearing %sexclude list\n", who_am_i(), listp->debug_type); } - free_exclude_list(listp); + clear_exclude_list(listp); continue; } @@ -311,7 +310,7 @@ void add_exclude(struct exclude_list_struct *listp, const char *pattern, if (verbose > 2) { rprintf(FINFO, "[%s] add_exclude(%.*s, %s%sclude)\n", - who_am_i(), pat_len, cp, listp->debug_type, + who_am_i(), (int)pat_len, cp, listp->debug_type, mflags & MATCHFLG_INCLUDE ? "in" : "ex"); } }