aboutsummaryrefslogtreecommitdiff
path: root/ft_strcpy.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-21 02:06:06 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-21 02:06:06 +0100
commitafc8c70a66773563f6e7429b500abcbab631722b (patch)
tree731b50b430b493280ce97a557f86f45cb2f37780 /ft_strcpy.c
parentf96be9ba455b0a71562e732664717b507b4bd548 (diff)
downloadlibft-afc8c70a66773563f6e7429b500abcbab631722b.tar.gz
libft-afc8c70a66773563f6e7429b500abcbab631722b.tar.bz2
libft-afc8c70a66773563f6e7429b500abcbab631722b.zip
ft_memset and ft_strlen optimization
Diffstat (limited to 'ft_strcpy.c')
-rw-r--r--ft_strcpy.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/ft_strcpy.c b/ft_strcpy.c
index 6d94aef..9677b24 100644
--- a/ft_strcpy.c
+++ b/ft_strcpy.c
@@ -6,20 +6,13 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:38:36 by cacharle #+# #+# */
-/* Updated: 2019/10/07 10:39:03 by cacharle ### ########.fr */
+/* Updated: 2019/11/20 23:25:57 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
+#include "libft.h"
+
char *ft_strcpy(char *dest, const char *src)
{
- int i;
-
- i = 0;
- while (src[i])
- {
- dest[i] = src[i];
- i++;
- }
- dest[i] = '\0';
- return (dest);
+ return (ft_memcpy(dest, src, ft_strlen(src) + 1));
}