diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-21 02:06:06 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-21 02:06:06 +0100 |
| commit | afc8c70a66773563f6e7429b500abcbab631722b (patch) | |
| tree | 731b50b430b493280ce97a557f86f45cb2f37780 /ft_strchr.c | |
| parent | f96be9ba455b0a71562e732664717b507b4bd548 (diff) | |
| download | libft-afc8c70a66773563f6e7429b500abcbab631722b.tar.gz libft-afc8c70a66773563f6e7429b500abcbab631722b.tar.bz2 libft-afc8c70a66773563f6e7429b500abcbab631722b.zip | |
ft_memset and ft_strlen optimization
Diffstat (limited to 'ft_strchr.c')
| -rw-r--r-- | ft_strchr.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/ft_strchr.c b/ft_strchr.c index 0ae161b..50bfc0a 100644 --- a/ft_strchr.c +++ b/ft_strchr.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/07 10:14:47 by cacharle #+# #+# */ -/* Updated: 2019/11/20 04:02:02 by cacharle ### ########.fr */ +/* Updated: 2019/11/21 01:04:52 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,13 +14,5 @@ char *ft_strchr(const char *s, int c) { - while (*s) - { - if (*s == (char)c) - return ((char*)s); - s++; - } - if ((char)c == '\0') - return ((char*)s); - return (NULL); + return (ft_memchr(s, c, ft_strlen(s) + 1)); } |
