| 735 | /* acl_vstring_rstrcasestr - locate byte in buffer */ |
| 736 | |
| 737 | char *acl_vstring_rstrcasestr(ACL_VSTRING *vp, const char *needle) |
| 738 | { |
| 739 | const unsigned char *cm = maptolower; |
| 740 | unsigned char *cp; |
| 741 | const unsigned char *np = 0, *needle_end; |
| 742 | |
| 743 | if (vp == NULL || needle == NULL || *needle == 0) { |
| 744 | return NULL; |
| 745 | } |
| 746 | |
| 747 | needle_end = (const unsigned char *) needle + strlen(needle) - 1; |
| 748 | |
| 749 | for (cp = (unsigned char *) acl_vstring_end(vp) - 1; |
| 750 | cp >= (unsigned char *) acl_vstring_str(vp); cp--) { |
| 751 | if (np) { |
| 752 | if (*cp == cm[*np]) { |
| 753 | if (--np < (const unsigned char *) needle) { |
| 754 | return ((char *) cp); |
| 755 | } |
| 756 | } else { |
| 757 | np = 0; |
| 758 | } |
| 759 | } |
| 760 | if (!np && *cp == cm[*needle_end]) { |
| 761 | np = needle_end - 1; |
| 762 | if (np < (const unsigned char *) needle) { |
| 763 | return (char *) cp; |
| 764 | } |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | return NULL; |
| 769 | } |
| 770 | |
| 771 | /* acl_vstring_insert - insert text into string */ |
| 772 |
no outgoing calls
no test coverage detected
searching dependent graphs…