comparison src/core/ngx_string.h @ 2201:49a269b67213

ngx_strlchr()
author Igor Sysoev <igor@sysoev.ru>
date Tue, 26 Aug 2008 14:16:36 +0000
parents 8c6521eedf84
children 2f9c37445ffb
comparison
equal deleted inserted replaced
2200:fd15c193572d 2201:49a269b67213
52 /* msvc and icc7 compile strcmp() to inline loop */ 52 /* msvc and icc7 compile strcmp() to inline loop */
53 #define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2) 53 #define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2)
54 54
55 55
56 #define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2) 56 #define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2)
57 #define ngx_strlen(s) strlen((const char *) s)
58
57 #define ngx_strchr(s1, c) strchr((const char *) s1, (int) c) 59 #define ngx_strchr(s1, c) strchr((const char *) s1, (int) c)
58 #define ngx_strlen(s) strlen((const char *) s) 60
61 static ngx_inline u_char *
62 ngx_strlchr(u_char *p, u_char *last, u_char c)
63 {
64 while (p < last) {
65
66 if (*p == c) {
67 return p;
68 }
69
70 p++;
71 }
72
73 return NULL;
74 }
59 75
60 76
61 /* 77 /*
62 * msvc and icc7 compile memset() to the inline "rep stos" 78 * msvc and icc7 compile memset() to the inline "rep stos"
63 * while ZeroMemory() and bzero() are the calls. 79 * while ZeroMemory() and bzero() are the calls.