comparison src/core/ngx_string.c @ 2680:82e3946062be

backout r2677 and fix ngx_strlcasestrn() again
author Igor Sysoev <igor@sysoev.ru>
date Mon, 06 Apr 2009 11:42:42 +0000
parents 278f30cc7d48
children 819bea4e964e
comparison
equal deleted inserted replaced
2679:0a209cac352a 2680:82e3946062be
701 u_char * 701 u_char *
702 ngx_strlcasestrn(u_char *s1, u_char *last, u_char *s2, size_t n) 702 ngx_strlcasestrn(u_char *s1, u_char *last, u_char *s2, size_t n)
703 { 703 {
704 ngx_uint_t c1, c2; 704 ngx_uint_t c1, c2;
705 705
706 if (s1 <= last) {
707 return NULL;
708 }
709
710 c2 = (ngx_uint_t) *s2++; 706 c2 = (ngx_uint_t) *s2++;
711 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; 707 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2;
712 last -= n; 708 last -= n;
713 709
714 do { 710 do {
715 do { 711 do {
716 if (s1 == last) { 712 if (s1 >= last) {
717 return NULL; 713 return NULL;
718 } 714 }
719 715
720 c1 = (ngx_uint_t) *s1++; 716 c1 = (ngx_uint_t) *s1++;
721 717