Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
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
zhul
criu
Commits
e5eb73ea
Commit
e5eb73ea
authored
May 08, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: Introduce strstartswith helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
c473461d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
util.h
include/util.h
+18
-0
No files found.
include/util.h
View file @
e5eb73ea
...
...
@@ -274,4 +274,22 @@ extern int read_fd_link(int lfd, char *buf, size_t size);
int
vaddr_to_pfn
(
unsigned
long
vaddr
,
u64
*
pfn
);
/*
* Check whether @str starts with @sub
*/
static
inline
bool
strstartswith
(
char
*
str
,
char
*
sub
)
{
while
(
1
)
{
if
(
*
sub
==
'\0'
)
/* end of sub -- match */
return
true
;
if
(
*
str
==
'\0'
)
/* end of str, sub is NOT ended -- miss */
return
false
;
if
(
*
str
!=
*
sub
)
return
false
;
str
++
;
sub
++
;
}
}
#endif
/* __CR_UTIL_H__ */
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