Changeset 3f33b95 in mainline
- Timestamp:
- 2011-08-18T12:29:37Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3190e88
- Parents:
- 7e10aee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/string.c
r7e10aee r3f33b95 460 460 * not found. 461 461 */ 462 char * posix_strstr (const char* haystack, const char*needle)462 char *posix_strstr(const char *haystack, const char *needle) 463 463 { 464 464 assert(haystack != NULL); … … 467 467 /* Special case - needle is an empty string. */ 468 468 if (needle[0] == '\0') { 469 return (char *) haystack;469 return (char *) haystack; 470 470 } 471 471 … … 492 492 size_t npos = 0; 493 493 494 for (size_t hpos = 0; haystack[hpos] != '\0'; ++ 494 for (size_t hpos = 0; haystack[hpos] != '\0'; ++hpos) { 495 495 while (npos != 0 && haystack[hpos] != needle[npos]) { 496 496 npos = prefix_table[npos]; … … 498 498 499 499 if (haystack[hpos] == needle[npos]) { 500 npos 500 npos++; 501 501 502 502 if (npos == nlen) { 503 return (char *) (haystack + hpos - nlen + 1);503 return (char *) (haystack + hpos - nlen + 1); 504 504 } 505 505 }
Note:
See TracChangeset
for help on using the changeset viewer.