X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/2b6b4d539b0aab98b1cbb9d8c639cb12473aae94..e1b3d5c4be46ee0b17a98aa48cb7cb152c4a008b:/exclude.c diff --git a/exclude.c b/exclude.c index 577c289b..d25adb34 100644 --- a/exclude.c +++ b/exclude.c @@ -93,13 +93,13 @@ static int check_one_exclude(char *name,struct exclude_struct *ex, } if (ex->regular_exp) { - if (fnmatch(ex->pattern, name, 0) == 0) + if (fnmatch(pattern, name, 0) == 0) return 1; } else { int l1 = strlen(name); - int l2 = strlen(ex->pattern); + int l2 = strlen(pattern); if (l2 <= l1 && - strcmp(name+(l1-l2),ex->pattern) == 0 && + strcmp(name+(l1-l2),pattern) == 0 && (l1==l2 || (!match_start && name[l1-(l2+1)] == '/'))) return 1; } @@ -146,11 +146,7 @@ void add_exclude_list(char *pattern,struct exclude_struct ***list, int include) return; } - if (!*list) { - *list = (struct exclude_struct **)malloc(sizeof(struct exclude_struct *)*2); - } else { - *list = (struct exclude_struct **)realloc(*list,sizeof(struct exclude_struct *)*(len+2)); - } + *list = (struct exclude_struct **)Realloc(*list,sizeof(struct exclude_struct *)*(len+2)); if (!*list || !((*list)[len] = make_exclude(pattern, include))) out_of_memory("add_exclude");