From bf6dcd17133e4e29e09420e3252a4184be3b04b6 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 14 Apr 2004 23:33:34 +0000 Subject: [PATCH] Updated the exclude-list code to handle the new linked-list structure format. --- flist.c | 34 +++++++++++++++------------------- options.c | 2 +- t_stub.c | 4 ++-- util.c | 6 +++--- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/flist.c b/flist.c index 4d67c3c2..aa43235e 100644 --- a/flist.c +++ b/flist.c @@ -64,9 +64,9 @@ extern int sanitize_paths; extern int read_batch; extern int write_batch; -extern struct exclude_struct **exclude_list; -extern struct exclude_struct **server_exclude_list; -extern struct exclude_struct **local_exclude_list; +extern struct exclude_list_struct exclude_list; +extern struct exclude_list_struct server_exclude_list; +extern struct exclude_list_struct local_exclude_list; int io_error; @@ -226,18 +226,18 @@ static int check_exclude_file(char *fname, int is_dir, int exclude_level) return 0; } } - if (server_exclude_list - && check_exclude(server_exclude_list, fname, is_dir, - "server pattern")) + if (server_exclude_list.head + && check_exclude(&server_exclude_list, fname, is_dir, + "server pattern")) return 1; if (exclude_level != ALL_EXCLUDES) return 0; - if (exclude_list && check_exclude(exclude_list, fname, is_dir, - "pattern")) + if (exclude_list.head + && check_exclude(&exclude_list, fname, is_dir, "pattern")) return 1; - if (local_exclude_list - && check_exclude(local_exclude_list, fname, is_dir, - "local-cvsignore")) + if (local_exclude_list.head + && check_exclude(&local_exclude_list, fname, is_dir, + "local-cvsignore")) return 1; return 0; } @@ -956,10 +956,11 @@ void send_file_name(int f, struct file_list *flist, char *fname, if (recursive && S_ISDIR(file->mode) && !(file->flags & FLAG_MOUNT_POINT)) { - struct exclude_struct **last_exclude_list = local_exclude_list; + struct exclude_list_struct last_list = local_exclude_list; + memset(&local_exclude_list, 0, sizeof local_exclude_list); send_directory(f, flist, f_name_to(file, fbuf)); - local_exclude_list = last_exclude_list; - return; + free_exclude_list(&local_exclude_list); + local_exclude_list = last_list; } } @@ -994,8 +995,6 @@ static void send_directory(int f, struct file_list *flist, char *dir) offset++; } - local_exclude_list = NULL; - if (cvs_exclude) { if (strlcpy(p, ".cvsignore", MAXPATHLEN - offset) < MAXPATHLEN - offset) { @@ -1029,9 +1028,6 @@ static void send_directory(int f, struct file_list *flist, char *dir) dir, errno, strerror(errno)); } - if (local_exclude_list) - free_exclude_list(&local_exclude_list); /* Zeros pointer too */ - closedir(d); } diff --git a/options.c b/options.c index 35315311..e848cd7f 100644 --- a/options.c +++ b/options.c @@ -23,7 +23,7 @@ extern int sanitize_paths; extern char curr_dir[MAXPATHLEN]; -extern struct exclude_struct **exclude_list; +extern struct exclude_list_struct exclude_list; int make_backups = 0; diff --git a/t_stub.c b/t_stub.c index 7a930369..8cc3bf07 100644 --- a/t_stub.c +++ b/t_stub.c @@ -28,7 +28,7 @@ int modify_window = 0; int module_id = -1; -struct exclude_struct **server_exclude_list; +struct exclude_list_struct server_exclude_list; void rprintf(UNUSED(enum logcode code), const char *format, ...) { @@ -45,7 +45,7 @@ struct exclude_struct **server_exclude_list; exit(code); } - int check_exclude(UNUSED(struct exclude_struct **list), UNUSED(char *name), + int check_exclude(UNUSED(struct exclude_list_struct *listp), UNUSED(char *name), UNUSED(int name_is_dir), UNUSED(const char *type)) { /* This function doesn't really get called in this test context, so diff --git a/util.c b/util.c index fd630099..5c55ce41 100644 --- a/util.c +++ b/util.c @@ -28,6 +28,7 @@ #include "rsync.h" extern int verbose; +extern struct exclude_list_struct server_exclude_list; int sanitize_paths = 0; @@ -471,12 +472,11 @@ int lock_range(int fd, int offset, int len) static int exclude_server_path(char *arg) { char *s; - extern struct exclude_struct **server_exclude_list; - if (server_exclude_list) { + if (server_exclude_list.head) { for (s = arg; (s = strchr(s, '/')) != NULL; ) { *s = '\0'; - if (check_exclude(server_exclude_list, arg, 1, + if (check_exclude(&server_exclude_list, arg, 1, "server pattern")) { /* We must leave arg truncated! */ return 1; -- 2.34.1