diff options
author | Igor Sysoev <igor@sysoev.ru> | 2008-08-26 18:16:36 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2008-08-26 18:16:36 +0400 |
commit | caa4a45c0f7e885460fdca075b32b44c8cf0eae2 (patch) | |
tree | 492a5c862c68620c84daa5e0e580b5f4f6284b35 /src/core/ngx_string.h | |
parent | 154013c5f3c4b1ca3b6ac0e2f1797bc1694fe92e (diff) |
ngx_strlchr()
Diffstat (limited to 'src/core/ngx_string.h')
-rw-r--r-- | src/core/ngx_string.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index fff618b19..af2818639 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -54,9 +54,25 @@ void ngx_strlow(u_char *dst, u_char *src, size_t n); #define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2) -#define ngx_strchr(s1, c) strchr((const char *) s1, (int) c) #define ngx_strlen(s) strlen((const char *) s) +#define ngx_strchr(s1, c) strchr((const char *) s1, (int) c) + +static ngx_inline u_char * +ngx_strlchr(u_char *p, u_char *last, u_char c) +{ + while (p < last) { + + if (*p == c) { + return p; + } + + p++; + } + + return NULL; +} + /* * msvc and icc7 compile memset() to the inline "rep stos" |