- fixes from Tito
This commit is contained in:
parent
619b87dfa5
commit
4954d47ab0
@ -13,19 +13,16 @@
|
|||||||
* The strrstr() function finds the last occurrence of the substring needle
|
* The strrstr() function finds the last occurrence of the substring needle
|
||||||
* in the string haystack. The terminating nul characters are not compared.
|
* in the string haystack. The terminating nul characters are not compared.
|
||||||
*/
|
*/
|
||||||
char* strrstr(const char *haystack, const char *needle)
|
char *strrstr(const char *haystack, const char *needle)
|
||||||
{
|
{
|
||||||
char *r = NULL;
|
char *r = NULL;
|
||||||
|
|
||||||
if (!needle[0])
|
do {
|
||||||
return r;
|
char *p = strstr(haystack, needle);
|
||||||
while (1) {
|
if (p)
|
||||||
char *p = strstr(haystack, needle);
|
|
||||||
if (!p)
|
|
||||||
return r;
|
|
||||||
r = p;
|
r = p;
|
||||||
haystack = p + 1;
|
} while (*haystack++);
|
||||||
}
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __DO_STRRSTR_TEST
|
#ifdef __DO_STRRSTR_TEST
|
||||||
|
Loading…
Reference in New Issue
Block a user