mirror of
https://github.com/nginx/nginx.git
synced 2026-10-21 03:21:08 +00:00
ngx_strn2cmp()
This commit is contained in:
parent
618dc75c2d
commit
37cc165064
2 changed files with 26 additions and 0 deletions
|
|
@ -486,6 +486,31 @@ ngx_rstrncasecmp(u_char *s1, u_char *s2, size_t n)
|
|||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_strn2cmp(u_char *s1, u_char *s2, size_t n1, size_t n2)
|
||||
{
|
||||
size_t n;
|
||||
ngx_int_t m, z;
|
||||
|
||||
if (n1 <= n2) {
|
||||
n = n1;
|
||||
z = -1;
|
||||
|
||||
} else {
|
||||
n = n2;
|
||||
z = 1;
|
||||
}
|
||||
|
||||
m = ngx_strncmp(s1, s2, n);
|
||||
|
||||
if (m || n1 == n2) {
|
||||
return m;
|
||||
}
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_atoi(u_char *line, size_t n)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args);
|
|||
|
||||
ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n);
|
||||
ngx_int_t ngx_rstrncasecmp(u_char *s1, u_char *s2, size_t n);
|
||||
ngx_int_t ngx_strn2cmp(u_char *s1, u_char *s2, size_t n1, size_t n2);
|
||||
|
||||
ngx_int_t ngx_atoi(u_char *line, size_t n);
|
||||
ssize_t ngx_atosz(u_char *line, size_t n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue