Archived
1
0

push to github

This commit is contained in:
Adam Joly
2023-11-06 11:00:52 +01:00
parent 6d7341e6ab
commit 4dce3b1f9e
7 changed files with 43 additions and 34 deletions

View File

@ -6,7 +6,7 @@
# By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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_memcpy.c \
ft_memset.c \
ft_memmove.c \
ft_strlcpy.c \
ft_strlen.c \
ft_substr.c \
@ -36,7 +37,9 @@ SRCS = ft_atoi.c \
ft_strjoin.c \
ft_strncmp.c \
ft_strchr.c \
ft_itoa.c \
ft_calloc.c \
OBJS = $(SRCS:.c=.o)
FLAGS = -Werror -Wall -Wextra

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

View File

@ -6,13 +6,22 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <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);
}

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{
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);
}

View File

@ -6,30 +6,17 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{
int i;
int j;
char *str_result;
// char *ft_strchr(const char *s, int c)
// {
// int i;
i = 0;
j = 0;
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);
}
// i = 0;
// while (s[i])
// {
// }
// }

View File

@ -6,14 +6,13 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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
# define LIBFT_H
#include <complex.h>
# include <stddef.h>
# include <stdlib.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);
int ft_strncmp(const char *s1, const char *s2, size_t n);
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

BIN
libft.so

Binary file not shown.