(util_strcasestr): Reimplemented via mu_strcasestr()
Showing
1 changed file
with
1 additions
and
29 deletions
... | @@ -719,37 +719,9 @@ util_parse_ctime_date (const char *date, time_t * timep) | ... | @@ -719,37 +719,9 @@ util_parse_ctime_date (const char *date, time_t * timep) |
719 | char * | 719 | char * |
720 | util_strcasestr (const char *haystack, const char *needle) | 720 | util_strcasestr (const char *haystack, const char *needle) |
721 | { | 721 | { |
722 | register char *needle_end = strchr (needle, '\0'); | 722 | return mu_strcasestr (haystack, needle); |
723 | register char *haystack_end = strchr (haystack, '\0'); | ||
724 | register size_t needle_len = needle_end - needle; | ||
725 | register size_t needle_last = needle_len - 1; | ||
726 | register const char *begin; | ||
727 | |||
728 | if (needle_len == 0) | ||
729 | return (char *) haystack_end; | ||
730 | |||
731 | if ((size_t) (haystack_end - haystack) < needle_len) | ||
732 | return NULL; | ||
733 | |||
734 | for (begin = &haystack[needle_last]; begin < haystack_end; ++begin) | ||
735 | { | ||
736 | register const char *n = &needle[needle_last]; | ||
737 | register const char *h = begin; | ||
738 | |||
739 | do | ||
740 | if (tolower (*h) != tolower (*n)) | ||
741 | goto loop; /* continue for loop */ | ||
742 | while (--n >= needle && --h >= haystack); | ||
743 | |||
744 | return (char *) h; | ||
745 | |||
746 | loop:; | ||
747 | } | ||
748 | |||
749 | return NULL; | ||
750 | } | 723 | } |
751 | 724 | ||
752 | |||
753 | struct | 725 | struct |
754 | { | 726 | { |
755 | char *name; | 727 | char *name; | ... | ... |
-
Please register or sign in to post a comment