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

Function tpl_strstr

app/wizard/tpllib.cpp:82–108  ·  view source on GitHub ↗

Binary safe string search */

Source from the content-addressed store, hash-verified

80
81/* Binary safe string search */
82static const char *tpl_strstr(const char *haystack,
83 ssize_t haystack_len,
84 const char *needle,
85 int needle_len)
86{
87 ssize_t i;
88 const char *p_toofar = haystack + haystack_len - needle_len + 1;
89
90 if (p_toofar <= haystack)
91 return NULL;
92
93 do
94 {
95 if (*haystack == *needle)
96 {
97 for (i = 1; i != needle_len && haystack[i] == needle[i]; i++);
98
99 if (i == needle_len)
100 return haystack;
101 }
102
103 haystack++;
104 }
105 while (haystack != p_toofar);
106
107 return NULL;
108}
109
110
111static tpl_node_t* create_node(int len)

Callers 1

tpl_constructFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…