MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / strstr

Function strstr

src/PowerPC_EABI_Support/src/MSL_C/MSL_Common/string.c:271–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271char* strstr(const char *str, const char *pat) {
272 unsigned char* s1 = (unsigned char*)str - 1;
273 unsigned char* p1 = (unsigned char*)pat - 1;
274 unsigned long firstc, c1, c2;
275
276 if ((pat == 0) || (!(firstc = *++p1))) {
277 return ((char*)str);
278 }
279
280 while (c1 = *++s1) {
281 if (c1 == firstc) {
282 const unsigned char* s2 = s1 - 1;
283 const unsigned char* p2 = p1 - 1;
284
285 while ((c1 = *++s2) == (c2 = *++p2) && c1) {
286
287 }
288
289 if (!c2) {
290 return ((char*)s1);
291 }
292 }
293 }
294
295 return NULL;
296}
297
298void strerror(void)
299{

Callers 2

zEntPlayer_StreakFXFunction · 0.85
xIniParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected