diff options
Diffstat (limited to 'missing/strstr.c')
| -rw-r--r-- | missing/strstr.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/missing/strstr.c b/missing/strstr.c index cdb6bc9a55..e6613c5d2f 100644 --- a/missing/strstr.c +++ b/missing/strstr.c @@ -1,22 +1,23 @@ /* public domain rewrite of strstr(3) */ -#include "missing.h" +#include "ruby/missing.h" + +size_t strlen(const char*); char * -strstr(haystack, needle) - char *haystack, *needle; +strstr(const char *haystack, const char *needle) { - char *hend; - char *a, *b; + const char *hend; + const char *a, *b; - if (*needle == 0) return haystack; + if (*needle == 0) return (char *)haystack; hend = haystack + strlen(haystack) - strlen(needle) + 1; while (haystack < hend) { if (*haystack == *needle) { a = haystack; b = needle; for (;;) { - if (*b == 0) return haystack; + if (*b == 0) return (char *)haystack; if (*a++ != *b++) { break; } |
