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
e03dfae5
Commit
e03dfae5
authored
Jan 15, 2002
by
Martin Pool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change gratuituous strlcat's into strlcpy, since we already know the
length of the existing string.
parent
c7677b89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
flist.c
flist.c
+13
-3
No files found.
flist.c
View file @
e03dfae5
...
...
@@ -1018,6 +1018,10 @@ oom:
}
/*
* XXX: This is currently the hottest function while building the file
* list, because building f_name()s every time is expensive.
**/
int
file_compare
(
struct
file_struct
**
f1
,
struct
file_struct
**
f2
)
{
if
(
!
(
*
f1
)
->
basename
&&
!
(
*
f2
)
->
basename
)
return
0
;
...
...
@@ -1179,6 +1183,10 @@ static void clean_flist(struct file_list *flist, int strip_root)
/*
* return the full filename of a flist entry
*
* This function is too expensive at the moment, because it copies
* strings when often we only want to compare them. In any case,
* using strlcat is silly because it will walk the string repeatedly.
*/
char
*
f_name
(
struct
file_struct
*
f
)
{
...
...
@@ -1191,9 +1199,11 @@ char *f_name(struct file_struct *f)
n
=
(
n
+
1
)
%
10
;
if
(
f
->
dirname
)
{
strlcpy
(
p
,
f
->
dirname
,
MAXPATHLEN
);
strlcat
(
p
,
"/"
,
MAXPATHLEN
);
strlcat
(
p
,
f
->
basename
,
MAXPATHLEN
);
int
off
;
off
=
strlcpy
(
p
,
f
->
dirname
,
MAXPATHLEN
);
off
+=
strlcpy
(
p
+
off
,
"/"
,
MAXPATHLEN
-
off
);
off
+=
strlcpy
(
p
+
off
,
f
->
basename
,
MAXPATHLEN
-
off
);
}
else
{
strlcpy
(
p
,
f
->
basename
,
MAXPATHLEN
);
}
...
...
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