X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/d9d6bc5278f96c2327fafa697324c8fc90142dbc..5f78da202569ff1a4126c85a497156f5a7604e9a:/flist.c diff --git a/flist.c b/flist.c index 7f57d377..ab729c80 100644 --- a/flist.c +++ b/flist.c @@ -95,6 +95,12 @@ static void finish_build_progress(const struct file_list *flist) } +void show_flist_stats(void) +{ + /* Nothing yet */ +} + + static struct string_area *string_area_new(int size) { struct string_area *a; @@ -273,13 +279,26 @@ static char *flist_dir; static void flist_expand(struct file_list *flist) { if (flist->count >= flist->malloced) { + size_t new_bytes; + void *new_ptr; + if (flist->malloced < 1000) flist->malloced += 1000; else flist->malloced *= 2; - flist->files = (struct file_struct **) - realloc(flist->files, - sizeof(flist->files[0]) * flist->malloced); + + new_bytes = sizeof(flist->files[0]) * flist->malloced; + + new_ptr = realloc(flist->files, new_bytes); + + if (verbose >= 2) { + rprintf(FINFO, RSYNC_NAME ": expand file_list to %.0f bytes, did%s move\n", + (double) new_bytes, + (new_ptr == flist->files) ? " not" : ""); + } + + flist->files = (struct file_struct **) new_ptr; + if (!flist->files) out_of_memory("flist_expand"); } @@ -292,7 +311,7 @@ static void send_file_entry(struct file_struct *file, int f, unsigned char flags; static time_t last_time; static mode_t last_mode; - static dev_t last_rdev; + static DEV64_T last_rdev; static uid_t last_uid; static gid_t last_gid; static char lastname[MAXPATHLEN]; @@ -411,7 +430,7 @@ static void receive_file_entry(struct file_struct **fptr, { static time_t last_time; static mode_t last_mode; - static dev_t last_rdev; + static DEV64_T last_rdev; static uid_t last_uid; static gid_t last_gid; static char lastname[MAXPATHLEN]; @@ -663,7 +682,7 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap, file->gid = st.st_gid; file->dev = st.st_dev; file->inode = st.st_ino; -#ifdef HAVE_ST_RDEV +#ifdef HAVE_STRUCT_STAT_ST_RDEV file->rdev = st.st_rdev; #endif @@ -1003,6 +1022,8 @@ struct file_list *recv_file_list(int f) for (flags = read_byte(f); flags; flags = read_byte(f)) { + int i = flist->count; + flist_expand(flist); receive_file_entry(&flist->files[i], flags, f);