Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
e190da78
Commit
e190da78
authored
Jun 09, 2011
by
schu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fileops: add convenience function is_dot_or_dotdot()
Signed-off-by: schu <schu-github@schulog.org>
parent
a6e0f315
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
src/fileops.c
+2
-7
src/fileops.h
+8
-0
No files found.
src/fileops.c
View file @
e190da78
...
...
@@ -231,13 +231,8 @@ int git_futils_direach(
size_t
de_len
;
int
result
;
/* always skip '.' and '..' */
if
(
de
->
d_name
[
0
]
==
'.'
)
{
if
(
de
->
d_name
[
1
]
==
'\0'
)
continue
;
if
(
de
->
d_name
[
1
]
==
'.'
&&
de
->
d_name
[
2
]
==
'\0'
)
continue
;
}
if
(
is_dot_or_dotdot
(
de
->
d_name
))
continue
;
de_len
=
strlen
(
de
->
d_name
);
if
(
path_sz
<
wd_len
+
de_len
+
1
)
{
...
...
src/fileops.h
View file @
e190da78
...
...
@@ -102,6 +102,14 @@ extern int git_futils_mv_withpath(const char *from, const char *to);
*/
extern
git_off_t
git_futils_filesize
(
git_file
fd
);
/* Taken from git.git */
static
inline
int
is_dot_or_dotdot
(
const
char
*
name
)
{
return
(
name
[
0
]
==
'.'
&&
(
name
[
1
]
==
'\0'
||
(
name
[
1
]
==
'.'
&&
name
[
2
]
==
'\0'
)));
}
/**
* Read-only map all or part of a file into memory.
* When possible this function should favor a virtual memory
...
...
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