MCPcopy Create free account
hub / github.com/TurningWheel/Barony / stringStr

Function stringStr

src/main.cpp:150–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150const char* stringStr(const char* str1, const char* str2, size_t str1_size, size_t str2_size) {
151 // verify input
152 assert(str1);
153 assert(str2);
154 if (!str1 || !str2) {
155 return nullptr;
156 }
157
158 // scan str1 for a match of str2
159 for (size_t s = 0; s < str1_size && str1[s] != '\0'; ++s) {
160 const char* ptr = str1 + s;
161 if (!stringCmp(ptr, str2, str1_size - s, str2_size)) {
162 return ptr;
163 }
164 }
165
166 // no match found
167 return nullptr;
168}
169
170char* stringStr(char* str1, const char* str2, size_t str1_size, size_t str2_size) {
171 // verify input

Callers 1

doorFrameSpriteFunction · 0.85

Calls 1

stringCmpFunction · 0.85

Tested by

no test coverage detected