File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# By: phelebra <xhelp00@gmail.com> +#+ +:+ +#+ #
77# +#+#+#+#+#+ +#+ #
88# Created: 2023/01/13 09:54:20 by phelebra #+# #+# #
9- # Updated: 2023/01/13 14:20:36 by phelebra ### ########.fr #
9+ # Updated: 2023/01/13 16:18:59 by phelebra ### ########.fr #
1010# #
1111# **************************************************************************** #
1212
@@ -16,12 +16,12 @@ RM := rm -f
1616
1717NAME := libft.a
1818
19- SRCS := ft_isascii.c ft_isprint.c ft_isalpha.c ft_isdigit.c ft_isalnum.c \
20- ft_tolower.c ft_toupper.c ft_strlen.c ft_memset.c ft_memchr.c \
21- ft_atoi.c ft_memcmp.c ft_strncmp.c \
19+ SRCS := ft_isascii.c ft_isprint.c ft_isalpha.c ft_isdigit.c ft_isalnum.c \
20+ ft_tolower.c ft_toupper.c ft_strlen.c ft_memset.c ft_memchr.c \
21+ ft_atoi.c ft_memcmp.c ft_strncmp.c ft_memcpy.c ft_memmove.c \
2222 # ft_strlcpy.c ft_strlcat.c \
2323 ft_strnstr.c ft_strchr.c ft_strrchr.c \
24- ft_bzero.c ft_memcpy.c ft_memmove.c \
24+ ft_bzero.c \
2525 ft_calloc.c ft_strdup.c ft_substr.c ft_strjoin.c \
2626 ft_strtrim.c ft_split.c ft_itoa.c ft_strmapi.c ft_striteri.c \
2727 ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c ft_putnbr_fd.c \
Original file line number Diff line number Diff line change 11• bzero
2- • memcpy
3- • memmove
42• strlcpy
53• strlcat
64• strchr
75• strrchr
8- • strncmp
9- • memchr - to be tested
10- • memcmp
116• strnstr
127• calloc
138• strdup
Original file line number Diff line number Diff line change 66/* By: phelebra <xhelp00@gmail.com> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2023/01/10 17:03:08 by phelebra #+# #+# */
9- /* Updated: 2023/01/13 10:31:48 by phelebra ### ########.fr */
9+ /* Updated: 2023/01/13 15:42:56 by phelebra ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
1313#include "libft.h"
14+
15+ void * ft_memcpy (void * dest , const void * src , size_t n )
16+ {
17+ size_t i ;
18+
19+ i = 0 ;
20+ if (!dest & !src )
21+ return (0 );
22+ while (i < n )
23+ {
24+ ((unsigned char * )dest )[i ] = ((unsigned char * )src )[i ];
25+ i ++ ;
26+ }
27+ return (dest );
28+ }
Original file line number Diff line number Diff line change 66/* By: phelebra <xhelp00@gmail.com> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2023/01/10 17:03:38 by phelebra #+# #+# */
9- /* Updated: 2023/01/13 10:31:45 by phelebra ### ########.fr */
9+ /* Updated: 2023/01/13 16:32:57 by phelebra ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
1313#include "libft.h"
14+
15+ void * ft_memmove (void * dest , const void * src , size_t n )
16+ {
17+ size_t i ;
18+
19+ if (!dest && !src )
20+ return (0 );
21+ i = 0 ;
22+ if ((size_t )dest - (size_t )src < n )
23+ {
24+ i = n - 1 ;
25+ while (i < n )
26+ {
27+ ((unsigned char * )dest )[i ] = ((unsigned char * )src )[i ];
28+ i -- ;
29+ }
30+ }
31+ else
32+ {
33+ while (i < n )
34+ {
35+ ((unsigned char * )dest )[i ] = ((unsigned char * )src )[i ];
36+ i ++ ;
37+ }
38+ }
39+ return (dest );
40+ }
Original file line number Diff line number Diff line change 66/* By: phelebra <xhelp00@gmail.com> +#+ +:+ +#+ */
77/* +#+#+#+#+#+ +#+ */
88/* Created: 2023/01/13 10:17:52 by phelebra #+# #+# */
9- /* Updated: 2023/01/13 14:19:01 by phelebra ### ########.fr */
9+ /* Updated: 2023/01/13 16:21:26 by phelebra ### ########.fr */
1010/* */
1111/* ************************************************************************** */
1212
1313#ifndef LIBFT_H
1414# define LIBFT_H
1515
16- #include <unistd.h>
16+ # include <unistd.h>
1717
18- int ft_isalpha (int c );
19- int ft_isdigit (int c );
20- int ft_isalnum (int c );
21- int ft_isascii (int c );
22- int ft_isprint (int c );
23- int ft_tolower (int c );
24- int ft_toupper (int c );
25- int ft_atoi (const char * s );
18+ int ft_isalpha (int c );
19+ int ft_isdigit (int c );
20+ int ft_isalnum (int c );
21+ int ft_isascii (int c );
22+ int ft_isprint (int c );
23+ int ft_tolower (int c );
24+ int ft_toupper (int c );
25+ int ft_atoi (const char * s );
2626size_t ft_strlen (char * s );
2727void * ft_memset (void * p , int c , size_t n );
2828void * ft_memchr (const void * s , int c , size_t n );
29- int ft_memcmp (const void * s1 , const void * s2 , size_t n );
30- int ft_strncmp (const char * s1 , const char * s2 , size_t n );
29+ int ft_memcmp (const void * s1 , const void * s2 , size_t n );
30+ int ft_strncmp (const char * s1 , const char * s2 , size_t n );
31+ void * ft_memcpy (void * dest , const void * src , size_t n );
32+ void * ft_memmove (void * dest , const void * src , size_t n );
3133
3234#endif
You can’t perform that action at this time.
0 commit comments