Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
fc635a93
Commit
fc635a93
authored
Nov 17, 2016
by
Marko Mikulicic
Committed by
Cesanta Bot
Nov 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mg_ncasecmp and sister to common string utils
PUBLISHED_FROM=182c43c3bd82190cb816c8ebaddccc13a94950d0
parent
81f738af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
47 deletions
+29
-47
intro.md
docs/c-api/util.h/intro.md
+0
-2
mg_casecmp.md
docs/c-api/util.h/mg_casecmp.md
+0
-10
mg_ncasecmp.md
docs/c-api/util.h/mg_ncasecmp.md
+0
-10
mongoose.c
mongoose.c
+19
-15
mongoose.h
mongoose.h
+10
-10
No files found.
docs/c-api/util.h/intro.md
View file @
fc635a93
...
...
@@ -8,7 +8,6 @@ items:
-
{
name
:
mg_base64_decode.md
}
-
{
name
:
mg_base64_encode.md
}
-
{
name
:
mg_basic_auth_header.md
}
-
{
name
:
mg_casecmp.md
}
-
{
name
:
mg_conn_addr_to_str.md
}
-
{
name
:
mg_fopen.md
}
-
{
name
:
mg_hexdump.md
}
...
...
@@ -17,7 +16,6 @@ items:
-
{
name
:
mg_match_prefix.md
}
-
{
name
:
mg_mbuf_append_base64.md
}
-
{
name
:
mg_mbuf_append_base64_putc.md
}
-
{
name
:
mg_ncasecmp.md
}
-
{
name
:
mg_next_comma_list_entry.md
}
-
{
name
:
mg_open.md
}
-
{
name
:
mg_skip.md
}
...
...
docs/c-api/util.h/mg_casecmp.md
deleted
100644 → 0
View file @
81f738af
---
title
:
"
mg_casecmp()"
decl_name
:
"
mg_casecmp"
symbol_kind
:
"
func"
signature
:
|
int mg_casecmp(const char *s1, const char *s2);
---
Cross-platform version of
`strcasecmp()`
.
docs/c-api/util.h/mg_ncasecmp.md
deleted
100644 → 0
View file @
81f738af
---
title
:
"
mg_ncasecmp()"
decl_name
:
"
mg_ncasecmp"
symbol_kind
:
"
func"
signature
:
|
int mg_ncasecmp(const char *s1, const char *s2, size_t len);
---
Cross-platform version of
`strncasecmp()`
.
mongoose.c
View file @
fc635a93
...
...
@@ -1794,6 +1794,24 @@ int64_t cs_to64(const char *s) {
}
#endif
static
int
str_util_lowercase
(
const
char
*
s
)
{
return
tolower
(
*
(
const
unsigned
char
*
)
s
);
}
int
mg_ncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
)
{
int
diff
=
0
;
if
(
len
>
0
)
do
{
diff
=
str_util_lowercase
(
s1
++
)
-
str_util_lowercase
(
s2
++
);
}
while
(
diff
==
0
&&
s1
[
-
1
]
!=
'\0'
&&
--
len
>
0
);
return
diff
;
}
int
mg_casecmp
(
const
char
*
s1
,
const
char
*
s2
)
{
return
mg_ncasecmp
(
s1
,
s2
,
(
size_t
)
~
0
);
}
#endif
/* EXCLUDE_COMMON */
#ifdef MG_MODULE_LINES
#line 1 "mongoose/src/tun.h"
...
...
@@ -8891,7 +8909,7 @@ struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
/* For platforms with limited libc */
#ifndef MAX
#define MAX(a,
b) ((a) > (b)? (a)
: (b))
#define MAX(a,
b) ((a) > (b) ? (a)
: (b))
#endif
const
char
*
mg_skip
(
const
char
*
s
,
const
char
*
end
,
const
char
*
delims
,
...
...
@@ -8907,20 +8925,6 @@ static int lowercase(const char *s) {
return
tolower
(
*
(
const
unsigned
char
*
)
s
);
}
int
mg_ncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
)
{
int
diff
=
0
;
if
(
len
>
0
)
do
{
diff
=
lowercase
(
s1
++
)
-
lowercase
(
s2
++
);
}
while
(
diff
==
0
&&
s1
[
-
1
]
!=
'\0'
&&
--
len
>
0
);
return
diff
;
}
int
mg_casecmp
(
const
char
*
s1
,
const
char
*
s2
)
{
return
mg_ncasecmp
(
s1
,
s2
,
(
size_t
)
~
0
);
}
#if MG_ENABLE_FILESYSTEM
int
mg_stat
(
const
char
*
path
,
cs_stat_t
*
st
)
{
#ifdef _WIN32
...
...
mongoose.h
View file @
fc635a93
...
...
@@ -1859,6 +1859,16 @@ char *strdup(const char *src);
int64_t
cs_to64
(
const
char
*
s
);
#endif
/*
* Cross-platform version of `strncasecmp()`.
*/
int
mg_ncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
);
/*
* Cross-platform version of `strcasecmp()`.
*/
int
mg_casecmp
(
const
char
*
s1
,
const
char
*
s2
);
#ifdef __cplusplus
}
#endif
...
...
@@ -3640,16 +3650,6 @@ extern "C" {
const
char
*
mg_skip
(
const
char
*
s
,
const
char
*
end_string
,
const
char
*
delimiters
,
struct
mg_str
*
v
);
/*
* Cross-platform version of `strncasecmp()`.
*/
int
mg_ncasecmp
(
const
char
*
s1
,
const
char
*
s2
,
size_t
len
);
/*
* Cross-platform version of `strcasecmp()`.
*/
int
mg_casecmp
(
const
char
*
s1
,
const
char
*
s2
);
/*
* Decodes base64-encoded string `s`, `len` into the destination `dst`.
* The destination has to have enough space to hold the decoded buffer.
...
...
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