Mercurial > hg > nginx
comparison src/core/ngx_string.c @ 2668:2f9c37445ffb
ngx_strlcasestrn()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 04 Apr 2009 17:31:54 +0000 |
parents | 0433bc27e468 |
children | 278f30cc7d48 |
comparison
equal
deleted
inserted
replaced
2667:c1ac00c2bc75 | 2668:2f9c37445ffb |
---|---|
690 | 690 |
691 return --s1; | 691 return --s1; |
692 } | 692 } |
693 | 693 |
694 | 694 |
695 /* | |
696 * ngx_strlcasestrn() is intended to search for static substring | |
697 * with known length in string until the argument last. The argument n | |
698 * must be length of the second substring - 1. | |
699 */ | |
700 | |
701 u_char * | |
702 ngx_strlcasestrn(u_char *s1, u_char *last, u_char *s2, size_t n) | |
703 { | |
704 ngx_uint_t c1, c2; | |
705 | |
706 c2 = (ngx_uint_t) *s2++; | |
707 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; | |
708 last -= n; | |
709 | |
710 do { | |
711 do { | |
712 if (s1 == last) { | |
713 return NULL; | |
714 } | |
715 | |
716 c1 = (ngx_uint_t) *s1++; | |
717 | |
718 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; | |
719 | |
720 } while (c1 != c2); | |
721 | |
722 } while (ngx_strncasecmp(s1, s2, n) != 0); | |
723 | |
724 return --s1; | |
725 } | |
726 | |
727 | |
695 ngx_int_t | 728 ngx_int_t |
696 ngx_rstrncmp(u_char *s1, u_char *s2, size_t n) | 729 ngx_rstrncmp(u_char *s1, u_char *s2, size_t n) |
697 { | 730 { |
698 if (n == 0) { | 731 if (n == 0) { |
699 return 0; | 732 return 0; |