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
569e6f43
Commit
569e6f43
authored
Jul 14, 2007
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Made f_name() and f_name_cmp() take const pointers.
- Added f_name_has_prefix().
parent
0d585188
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
flist.c
flist.c
+15
-2
No files found.
flist.c
View file @
569e6f43
...
@@ -2449,6 +2449,8 @@ static void output_flist(struct file_list *flist)
...
@@ -2449,6 +2449,8 @@ static void output_flist(struct file_list *flist)
enum
fnc_state
{
s_DIR
,
s_SLASH
,
s_BASE
,
s_TRAILING
};
enum
fnc_state
{
s_DIR
,
s_SLASH
,
s_BASE
,
s_TRAILING
};
enum
fnc_type
{
t_PATH
,
t_ITEM
};
enum
fnc_type
{
t_PATH
,
t_ITEM
};
static
int
found_prefix
;
/* Compare the names of two file_struct entities, similar to how strcmp()
/* Compare the names of two file_struct entities, similar to how strcmp()
* would do if it were operating on the joined strings.
* would do if it were operating on the joined strings.
*
*
...
@@ -2464,7 +2466,7 @@ enum fnc_type { t_PATH, t_ITEM };
...
@@ -2464,7 +2466,7 @@ enum fnc_type { t_PATH, t_ITEM };
* cannot (and never is in the current codebase). The basename component
* cannot (and never is in the current codebase). The basename component
* may be NULL (for a removed item), in which case it is considered to be
* may be NULL (for a removed item), in which case it is considered to be
* after any existing item. */
* after any existing item. */
int
f_name_cmp
(
struct
file_struct
*
f1
,
struct
file_struct
*
f2
)
int
f_name_cmp
(
const
struct
file_struct
*
f1
,
const
struct
file_struct
*
f2
)
{
{
int
dif
;
int
dif
;
const
uchar
*
c1
,
*
c2
;
const
uchar
*
c1
,
*
c2
;
...
@@ -2569,6 +2571,7 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
...
@@ -2569,6 +2571,7 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
}
}
/* FALL THROUGH */
/* FALL THROUGH */
case
s_TRAILING
:
case
s_TRAILING
:
found_prefix
=
1
;
if
(
!*
c1
)
if
(
!*
c1
)
return
0
;
return
0
;
type2
=
t_ITEM
;
type2
=
t_ITEM
;
...
@@ -2582,6 +2585,16 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
...
@@ -2582,6 +2585,16 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
return
dif
;
return
dif
;
}
}
/* Returns 1 if f1's filename has all of f2's filename as a prefix. This does
* not match if f2's basename is not an exact match of a path element in f1.
* E.g. /path/foo is not a prefix of /path/foobar/baz, but /path/foobar is. */
int
f_name_has_prefix
(
const
struct
file_struct
*
f1
,
const
struct
file_struct
*
f2
)
{
found_prefix
=
0
;
f_name_cmp
(
f1
,
f2
);
return
found_prefix
;
}
char
*
f_name_buf
(
void
)
char
*
f_name_buf
(
void
)
{
{
static
char
names
[
5
][
MAXPATHLEN
];
static
char
names
[
5
][
MAXPATHLEN
];
...
@@ -2596,7 +2609,7 @@ char *f_name_buf(void)
...
@@ -2596,7 +2609,7 @@ char *f_name_buf(void)
* buffer or one of 5 static buffers if fbuf is NULL. No size-checking is
* buffer or one of 5 static buffers if fbuf is NULL. No size-checking is
* done because we checked the size when creating the file_struct entry.
* done because we checked the size when creating the file_struct entry.
*/
*/
char
*
f_name
(
struct
file_struct
*
f
,
char
*
fbuf
)
char
*
f_name
(
const
struct
file_struct
*
f
,
char
*
fbuf
)
{
{
if
(
!
f
||
!
F_IS_ACTIVE
(
f
))
if
(
!
f
||
!
F_IS_ACTIVE
(
f
))
return
NULL
;
return
NULL
;
...
...
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