Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
M
mongoose
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
mongoose
Commits
4bc50852
Commit
4bc50852
authored
Jul 29, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exported string functions
parent
a9bb7d78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
mongoose.c
mongoose.c
+5
-5
mongoose.h
mongoose.h
+8
-0
No files found.
mongoose.c
View file @
4bc50852
...
...
@@ -588,7 +588,7 @@ const char *mg_version(void) {
return
MONGOOSE_VERSION
;
}
static
void
mg_strlcpy
(
register
char
*
dst
,
register
const
char
*
src
,
size_t
n
)
{
void
mg_strlcpy
(
register
char
*
dst
,
register
const
char
*
src
,
size_t
n
)
{
for
(;
*
src
!=
'\0'
&&
n
>
1
;
n
--
)
{
*
dst
++
=
*
src
++
;
}
...
...
@@ -599,7 +599,7 @@ static int lowercase(const char *s) {
return
tolower
(
*
(
const
unsigned
char
*
)
s
);
}
static
int
mg_strncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
)
{
int
mg_strncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
)
{
int
diff
=
0
;
if
(
len
>
0
)
...
...
@@ -610,7 +610,7 @@ static int mg_strncasecmp(const char *s1, const char *s2, size_t len) {
return
diff
;
}
static
int
mg_strcasecmp
(
const
char
*
s1
,
const
char
*
s2
)
{
int
mg_strcasecmp
(
const
char
*
s1
,
const
char
*
s2
)
{
int
diff
;
do
{
...
...
@@ -620,7 +620,7 @@ static int mg_strcasecmp(const char *s1, const char *s2) {
return
diff
;
}
static
char
*
mg_strndup
(
const
char
*
ptr
,
size_t
len
)
{
char
*
mg_strndup
(
const
char
*
ptr
,
size_t
len
)
{
char
*
p
;
if
((
p
=
(
char
*
)
malloc
(
len
+
1
))
!=
NULL
)
{
...
...
@@ -630,7 +630,7 @@ static char * mg_strndup(const char *ptr, size_t len) {
return
p
;
}
static
char
*
mg_strdup
(
const
char
*
str
)
{
char
*
mg_strdup
(
const
char
*
str
)
{
return
mg_strndup
(
str
,
strlen
(
str
));
}
...
...
mongoose.h
View file @
4bc50852
...
...
@@ -249,6 +249,14 @@ typedef void * (*mg_thread_func_t)(void *);
int
mg_start_thread
(
mg_thread_func_t
f
,
void
*
p
);
// Platform independent string utility functions.
void
mg_strlcpy
(
char
*
dst
,
const
char
*
src
,
size_t
n
);
int
mg_strncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
);
int
mg_strcasecmp
(
const
char
*
s1
,
const
char
*
s2
);
char
*
mg_strndup
(
const
char
*
ptr
,
size_t
len
);
char
*
mg_strdup
(
const
char
*
str
);
// Return Mongoose version.
const
char
*
mg_version
(
void
);
...
...
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