aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_hash.c4
-rw-r--r--src/core/ngx_string.c11
-rw-r--r--src/core/ngx_string.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index abd2cf173..c39395c7b 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -390,9 +390,7 @@ found:
elt->value = names[n].value;
elt->len = (u_char) names[n].key.len;
- for (i = 0; i < names[n].key.len; i++) {
- elt->name[i] = ngx_tolower(names[n].key.data[i]);
- }
+ ngx_strlow(elt->name, names[n].key.data, names[n].key.len);
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
}
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index 2da6c8319..203cd3e37 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -8,6 +8,17 @@
#include <ngx_core.h>
+void
+ngx_strlow(u_char *dst, u_char *src, size_t n)
+{
+ while (n--) {
+ *dst = ngx_tolower(*src);
+ dst++;
+ src++;
+ }
+}
+
+
u_char *
ngx_cpystrn(u_char *dst, u_char *src, size_t n)
{
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h
index dfb3bc4cc..fff618b19 100644
--- a/src/core/ngx_string.h
+++ b/src/core/ngx_string.h
@@ -43,6 +43,8 @@ typedef struct {
#define ngx_tolower(c) (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
#define ngx_toupper(c) (u_char) ((c >= 'a' && c <= 'z') ? (c & ~0x20) : c)
+void ngx_strlow(u_char *dst, u_char *src, size_t n);
+
#define ngx_strncmp(s1, s2, n) strncmp((const char *) s1, (const char *) s2, n)