ngx_strn2cmp()

This commit is contained in:
Igor Sysoev 2007-01-12 20:15:59 +00:00
parent 618dc75c2d
commit 37cc165064
2 changed files with 26 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);