Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
d9d6bc52
Commit
d9d6bc52
authored
Jan 25, 2002
by
Martin Pool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out code to grow the file list into a common location.
parent
ebed4c3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
36 deletions
+29
-36
flist.c
flist.c
+29
-36
No files found.
flist.c
View file @
d9d6bc52
...
...
@@ -266,6 +266,26 @@ static void send_directory(int f, struct file_list *flist, char *dir);
static
char
*
flist_dir
;
/**
* Make sure @p flist is big enough to hold at least @p flist->count
* entries.
**/
static
void
flist_expand
(
struct
file_list
*
flist
)
{
if
(
flist
->
count
>=
flist
->
malloced
)
{
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
);
if
(
!
flist
->
files
)
out_of_memory
(
"flist_expand"
);
}
}
static
void
send_file_entry
(
struct
file_struct
*
file
,
int
f
,
unsigned
base_flags
)
{
...
...
@@ -700,19 +720,7 @@ void send_file_name(int f, struct file_list *flist, char *fname,
if
(
show_build_progress_p
()
&
!
(
flist
->
count
%
100
))
emit_build_progress
(
flist
);
if
(
flist
->
count
>=
flist
->
malloced
)
{
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
);
if
(
!
flist
->
files
)
out_of_memory
(
"send_file_name"
);
}
flist_expand
(
flist
);
if
(
write_batch
)
/* dw */
file
->
flags
=
FLAG_DELETE
;
...
...
@@ -995,23 +1003,7 @@ struct file_list *recv_file_list(int f)
for
(
flags
=
read_byte
(
f
);
flags
;
flags
=
read_byte
(
f
))
{
int
i
=
flist
->
count
;
if
(
i
>=
flist
->
malloced
)
{
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
);
if
(
!
flist
->
files
)
goto
oom
;
}
flist_expand
(
flist
);
receive_file_entry
(
&
flist
->
files
[
i
],
flags
,
f
);
...
...
@@ -1146,12 +1138,9 @@ struct file_list *flist_new()
out_of_memory
(
"send_file_list"
);
flist
->
count
=
0
;
flist
->
malloced
=
1000
;
flist
->
files
=
(
struct
file_struct
**
)
malloc
(
sizeof
(
flist
->
files
[
0
])
*
flist
->
malloced
);
if
(
!
flist
->
files
)
out_of_memory
(
"send_file_list"
);
flist
->
malloced
=
0
;
flist
->
files
=
NULL
;
#if ARENA_SIZE > 0
flist
->
string_area
=
string_area_new
(
0
);
#else
...
...
@@ -1171,6 +1160,10 @@ void flist_free(struct file_list *flist)
free_file
(
flist
->
files
[
i
]);
free
(
flist
->
files
[
i
]);
}
/* FIXME: I don't think we generally need to blank the flist
* since it's about to be freed. This will just cause more
* memory traffic. If you want a freed-memory debugger, you
* know where to get it. */
memset
((
char
*
)
flist
->
files
,
0
,
sizeof
(
flist
->
files
[
0
])
*
flist
->
count
);
free
(
flist
->
files
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment