push to github
This commit is contained in:
7
Makefile
7
Makefile
@ -6,7 +6,7 @@
|
|||||||
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
|
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
||||||
# Updated: 2023/11/05 14:57:25 by adjoly ### ########.fr #
|
# Updated: 2023/11/05 22:23:43 by adjoly ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ SRCS = ft_atoi.c \
|
|||||||
ft_strdup.c \
|
ft_strdup.c \
|
||||||
ft_memcpy.c \
|
ft_memcpy.c \
|
||||||
ft_memset.c \
|
ft_memset.c \
|
||||||
|
ft_memmove.c \
|
||||||
ft_strlcpy.c \
|
ft_strlcpy.c \
|
||||||
ft_strlen.c \
|
ft_strlen.c \
|
||||||
ft_substr.c \
|
ft_substr.c \
|
||||||
@ -36,7 +37,9 @@ SRCS = ft_atoi.c \
|
|||||||
ft_strjoin.c \
|
ft_strjoin.c \
|
||||||
ft_strncmp.c \
|
ft_strncmp.c \
|
||||||
ft_strchr.c \
|
ft_strchr.c \
|
||||||
|
ft_itoa.c \
|
||||||
|
ft_calloc.c \
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
FLAGS = -Werror -Wall -Wextra
|
FLAGS = -Werror -Wall -Wextra
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/10/31 09:00:27 by adjoly #+# #+# */
|
/* Created: 2023/10/31 09:00:27 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/01 17:15:05 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 15:27:36 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
15
ft_calloc.c
15
ft_calloc.c
@ -6,13 +6,22 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/01 16:02:26 by adjoly #+# #+# */
|
/* Created: 2023/11/01 16:02:26 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/01 16:06:22 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 22:23:07 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "libft.h"
|
#include "libft.h"
|
||||||
|
#include <complex.h>
|
||||||
|
|
||||||
void *calloc(size_t nmemb, size_t size)
|
void *ft_calloc(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
|
void *result;
|
||||||
|
|
||||||
|
if (size != 0 && nmemb != 0 && (nmemb * size) / nmemb != size)
|
||||||
|
return (NULL);
|
||||||
|
result = malloc(size * nmemb);
|
||||||
|
if (result == NULL)
|
||||||
|
return (NULL);
|
||||||
|
ft_bzero(result, size * nmemb);
|
||||||
|
return (result);
|
||||||
}
|
}
|
||||||
|
13
ft_memmove.c
13
ft_memmove.c
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
|
/* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/05 14:52:24 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 22:05:37 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,5 +14,14 @@
|
|||||||
|
|
||||||
void *ft_memmove(void *dest, const void *src, size_t n)
|
void *ft_memmove(void *dest, const void *src, size_t n)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
i = -1;
|
||||||
|
if (dest > src)
|
||||||
|
while (n-- > 0)
|
||||||
|
((unsigned char *)dest)[n] = ((unsigned char *)src)[n];
|
||||||
|
else if (dest < src)
|
||||||
|
while (++i < n)
|
||||||
|
((unsigned char *)dest)[i] = ((unsigned char *)src)[i];
|
||||||
|
return (dest);
|
||||||
}
|
}
|
||||||
|
33
ft_strchr.c
33
ft_strchr.c
@ -6,30 +6,17 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
|
/* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/05 14:59:50 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 21:33:16 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
char *ft_strchr(const char *s, int c)
|
// char *ft_strchr(const char *s, int c)
|
||||||
{
|
// {
|
||||||
int i;
|
// int i;
|
||||||
int j;
|
|
||||||
char *str_result;
|
|
||||||
|
|
||||||
i = 0;
|
// i = 0;
|
||||||
j = 0;
|
// while (s[i])
|
||||||
str_result = 0;
|
// {
|
||||||
while (s[i] != c || s[i])
|
|
||||||
i++;
|
// }
|
||||||
if (s[i] == c)
|
// }
|
||||||
{
|
|
||||||
while (s[i])
|
|
||||||
{
|
|
||||||
str_result[j] = s[j + i];
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
return (str_result);
|
|
||||||
}
|
|
||||||
str_result[i] = '\0';
|
|
||||||
return (str_result);
|
|
||||||
}
|
|
||||||
|
7
libft.h
7
libft.h
@ -6,14 +6,13 @@
|
|||||||
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */
|
/* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */
|
||||||
/* Updated: 2023/11/05 14:57:55 by adjoly ### ########.fr */
|
/* Updated: 2023/11/05 21:34:36 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef LIBFT_H
|
#ifndef LIBFT_H
|
||||||
# define LIBFT_H
|
# define LIBFT_H
|
||||||
|
|
||||||
#include <complex.h>
|
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
@ -42,6 +41,8 @@ size_t ft_strlcat(char *dst, const char *src, size_t size);
|
|||||||
char *ft_strjoin(char const *s1, char const *s2);
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
int ft_isprint(int c);
|
int ft_isprint(int c);
|
||||||
void *memchr(const void *s, int c, size_t n);
|
void *ft_memchr(const void *s, int c, size_t n);
|
||||||
|
char *ft_itoa(int n);
|
||||||
|
void *ft_memmove(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
#endif
|
#endif
|
Reference in New Issue
Block a user