]> git.kaiwu.me - nginx.git/commitdiff
ngx_strlchr()
authorIgor Sysoev <igor@sysoev.ru>
Tue, 26 Aug 2008 14:16:36 +0000 (14:16 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 26 Aug 2008 14:16:36 +0000 (14:16 +0000)
src/core/ngx_string.h

index fff618b19ce8efeb0caaf17dea98d09a93af767c..af28186399bf8e1686a57f12df1e9f4c52017cf1 100644 (file)
@@ -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"