mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-03-11 19:06:38 -04:00
Tweaked the alloc/realloc code in flist_expand().
This commit is contained in:
12
flist.c
12
flist.c
@@ -282,7 +282,7 @@ static int flist_dir_len;
|
||||
**/
|
||||
void flist_expand(struct file_list *flist)
|
||||
{
|
||||
void *new_ptr;
|
||||
struct file_struct **new_ptr;
|
||||
|
||||
if (flist->count < flist->malloced)
|
||||
return;
|
||||
@@ -301,12 +301,8 @@ void flist_expand(struct file_list *flist)
|
||||
if (flist->malloced < flist->count)
|
||||
flist->malloced = flist->count;
|
||||
|
||||
if (flist->files) {
|
||||
new_ptr = realloc_array(flist->files,
|
||||
struct file_struct *, flist->malloced);
|
||||
} else {
|
||||
new_ptr = new_array(struct file_struct *, flist->malloced);
|
||||
}
|
||||
new_ptr = realloc_array(flist->files, struct file_struct *,
|
||||
flist->malloced);
|
||||
|
||||
if (verbose >= 2) {
|
||||
rprintf(FINFO, "[%s] expand file_list to %.0f bytes, did%s move\n",
|
||||
@@ -315,7 +311,7 @@ void flist_expand(struct file_list *flist)
|
||||
(new_ptr == flist->files) ? " not" : "");
|
||||
}
|
||||
|
||||
flist->files = (struct file_struct **) new_ptr;
|
||||
flist->files = new_ptr;
|
||||
|
||||
if (!flist->files)
|
||||
out_of_memory("flist_expand");
|
||||
|
||||
Reference in New Issue
Block a user