diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-01-12 20:15:59 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-01-12 20:15:59 +0000 |
commit | 37cc165064fd681ef453c59e28a9170d3338979a (patch) | |
tree | 78ce5db8b165b76c55b2f01dc1b44080dbe3b667 /src/core/ngx_string.c | |
parent | 618dc75c2db5ba83b472b4b9c02204c9514df82c (diff) | |
download | nginx-37cc165064fd681ef453c59e28a9170d3338979a.tar.gz nginx-37cc165064fd681ef453c59e28a9170d3338979a.zip |
ngx_strn2cmp()
Diffstat (limited to 'src/core/ngx_string.c')
-rw-r--r-- | src/core/ngx_string.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index ad2c9d8c8..2b2396052 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -487,6 +487,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) { ngx_int_t value; |