aboutsummaryrefslogtreecommitdiff
path: root/src/str/ft_strstr.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
commit5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch)
tree80911dc3c32e9f230750e7e1042d413dfb6efab2 /src/str/ft_strstr.c
parentee32953ea79616e72f5428cdf40c834714a891c9 (diff)
parentb96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff)
downloadlibft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip
Merge branch 'master' into ft_ssl
Diffstat (limited to 'src/str/ft_strstr.c')
-rw-r--r--src/str/ft_strstr.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/str/ft_strstr.c b/src/str/ft_strstr.c
index 4d4d403..893ae1e 100644
--- a/src/str/ft_strstr.c
+++ b/src/str/ft_strstr.c
@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "libft.h"
+#include "libft_str.h"
char *ft_strstr(const char *haystack, const char *needle)
{
@@ -19,11 +20,5 @@ char *ft_strstr(const char *haystack, const char *needle)
needle_len = ft_strlen(needle);
if (needle_len == 0)
return ((char*)haystack);
- while (*haystack)
- {
- if (ft_strnequ(haystack, needle, needle_len))
- return ((char*)haystack);
- haystack++;
- }
- return (NULL);
+ return (ft_memmem(haystack, ft_strlen(haystack), needle, needle_len));
}