Mercurial > hg > nginx
comparison src/core/ngx_string.c @ 3115:204ea173234f
style fix
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 11 Sep 2009 13:57:50 +0000 |
parents | 52e984126b2c |
children | 98e288c6dac3 |
comparison
equal
deleted
inserted
replaced
3114:1c4fcfe57af1 | 3115:204ea173234f |
---|---|
566 | 566 |
567 for ( ;; ) { | 567 for ( ;; ) { |
568 c1 = (ngx_uint_t) *s1++; | 568 c1 = (ngx_uint_t) *s1++; |
569 c2 = (ngx_uint_t) *s2++; | 569 c2 = (ngx_uint_t) *s2++; |
570 | 570 |
571 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; | 571 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; |
572 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; | 572 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; |
573 | 573 |
574 if (c1 == c2) { | 574 if (c1 == c2) { |
575 | 575 |
576 if (c1) { | 576 if (c1) { |
577 continue; | 577 continue; |
592 | 592 |
593 while (n) { | 593 while (n) { |
594 c1 = (ngx_uint_t) *s1++; | 594 c1 = (ngx_uint_t) *s1++; |
595 c2 = (ngx_uint_t) *s2++; | 595 c2 = (ngx_uint_t) *s2++; |
596 | 596 |
597 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; | 597 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; |
598 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; | 598 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; |
599 | 599 |
600 if (c1 == c2) { | 600 if (c1 == c2) { |
601 | 601 |
602 if (c1) { | 602 if (c1) { |
603 n--; | 603 n--; |
681 ngx_strcasestrn(u_char *s1, char *s2, size_t n) | 681 ngx_strcasestrn(u_char *s1, char *s2, size_t n) |
682 { | 682 { |
683 ngx_uint_t c1, c2; | 683 ngx_uint_t c1, c2; |
684 | 684 |
685 c2 = (ngx_uint_t) *s2++; | 685 c2 = (ngx_uint_t) *s2++; |
686 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; | 686 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; |
687 | 687 |
688 do { | 688 do { |
689 do { | 689 do { |
690 c1 = (ngx_uint_t) *s1++; | 690 c1 = (ngx_uint_t) *s1++; |
691 | 691 |
692 if (c1 == 0) { | 692 if (c1 == 0) { |
693 return NULL; | 693 return NULL; |
694 } | 694 } |
695 | 695 |
696 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; | 696 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; |
697 | 697 |
698 } while (c1 != c2); | 698 } while (c1 != c2); |
699 | 699 |
700 } while (ngx_strncasecmp(s1, (u_char *) s2, n) != 0); | 700 } while (ngx_strncasecmp(s1, (u_char *) s2, n) != 0); |
701 | 701 |
713 ngx_strlcasestrn(u_char *s1, u_char *last, u_char *s2, size_t n) | 713 ngx_strlcasestrn(u_char *s1, u_char *last, u_char *s2, size_t n) |
714 { | 714 { |
715 ngx_uint_t c1, c2; | 715 ngx_uint_t c1, c2; |
716 | 716 |
717 c2 = (ngx_uint_t) *s2++; | 717 c2 = (ngx_uint_t) *s2++; |
718 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; | 718 c2 = (c2 >= 'A' && c2 <= 'Z') ? (c2 | 0x20) : c2; |
719 last -= n; | 719 last -= n; |
720 | 720 |
721 do { | 721 do { |
722 do { | 722 do { |
723 if (s1 >= last) { | 723 if (s1 >= last) { |
724 return NULL; | 724 return NULL; |
725 } | 725 } |
726 | 726 |
727 c1 = (ngx_uint_t) *s1++; | 727 c1 = (ngx_uint_t) *s1++; |
728 | 728 |
729 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; | 729 c1 = (c1 >= 'A' && c1 <= 'Z') ? (c1 | 0x20) : c1; |
730 | 730 |
731 } while (c1 != c2); | 731 } while (c1 != c2); |
732 | 732 |
733 } while (ngx_strncasecmp(s1, s2, n) != 0); | 733 } while (ngx_strncasecmp(s1, s2, n) != 0); |
734 | 734 |
1338 | 1338 |
1339 if (dst == NULL) { | 1339 if (dst == NULL) { |
1340 | 1340 |
1341 /* find the number of the characters to be escaped */ | 1341 /* find the number of the characters to be escaped */ |
1342 | 1342 |
1343 n = 0; | 1343 n = 0; |
1344 | 1344 |
1345 for (i = 0; i < size; i++) { | 1345 for (i = 0; i < size; i++) { |
1346 if (escape[*src >> 5] & (1 << (*src & 0x1f))) { | 1346 if (escape[*src >> 5] & (1 << (*src & 0x1f))) { |
1347 n++; | 1347 n++; |
1348 } | 1348 } |