MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_vstring_rstrcasestr

Function acl_vstring_rstrcasestr

lib_acl/src/stdlib/acl_vstring.c:737–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735/* acl_vstring_rstrcasestr - locate byte in buffer */
736
737char *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

Callers 2

string_case_rfindFunction · 0.85
rfindMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…