Mercurial > hg > nginx
diff src/core/ngx_hash.c @ 2136:7a7c9e9024dd
ngx_hash_strlow()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Aug 2008 10:18:36 +0000 |
parents | 8c6521eedf84 |
children | deaa4cabecdc |
line wrap: on
line diff
--- a/src/core/ngx_hash.c Mon Aug 04 10:07:00 2008 +0000 +++ b/src/core/ngx_hash.c Mon Aug 04 10:18:36 2008 +0000 @@ -620,6 +620,24 @@ } +ngx_uint_t +ngx_hash_strlow(u_char *dst, u_char *src, size_t n) +{ + ngx_uint_t key; + + key = 0; + + while (n--) { + *dst = ngx_tolower(*src); + key = ngx_hash(key, *dst); + dst++; + src++; + } + + return key; +} + + ngx_int_t ngx_hash_keys_array_init(ngx_hash_keys_arrays_t *ha, ngx_uint_t type) { @@ -794,12 +812,7 @@ /* wildcard hash */ - k = 0; - - for (i = skip; i < last; i++) { - key->data[i] = ngx_tolower(key->data[i]); - k = ngx_hash(k, key->data[i]); - } + k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize;