aboutsummaryrefslogtreecommitdiff
path: root/ft_strchr.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-20 14:22:31 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-20 14:22:31 +0200
commit2a6b46d026e7ae16af85c4c211fb685f699a5377 (patch)
tree956b619911d872539382970e0a428e82d5ad886e /ft_strchr.c
parent43e6c82cad5d790c75c918a4eca85cdec894d1c8 (diff)
downloadlibft-2a6b46d026e7ae16af85c4c211fb685f699a5377.tar.gz
libft-2a6b46d026e7ae16af85c4c211fb685f699a5377.tar.bz2
libft-2a6b46d026e7ae16af85c4c211fb685f699a5377.zip
Part1 refactoring
Diffstat (limited to 'ft_strchr.c')
-rw-r--r--ft_strchr.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ft_strchr.c b/ft_strchr.c
index 048b2ec..45eecdd 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/10/07 10:40:04 by cacharle ### ########.fr */
+/* Updated: 2019/10/20 13:10:19 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,16 +14,13 @@
char *ft_strchr(const char *s, int c)
{
- char *cursor;
-
- cursor = (char*)s;
- while (*cursor)
+ while (*s)
{
- if (*cursor == (char)c)
- return (cursor);
- cursor++;
+ if (*s == (char)c)
+ return ((char*)s);
+ s++;
}
- if (c == 0)
- return (cursor);
+ if ((char)c == 0)
+ return ((char*)s);
return (NULL);
}