start of excution implementation

This commit is contained in:
2023-02-09 18:47:05 +01:00
parent 4258c1da62
commit 1a04f73b49
48 changed files with 312 additions and 51 deletions

View File

@ -12,7 +12,7 @@
CC = clang
SRCS = ft_contain_only.c ft_freer.c ft_is_in.c ft_random_generator.c ft_strchri.c ft_strcmp.c ft_strfjoin.c ft_strgen.c ft_strmerger.c ft_strndup.c ft_tabrealloc.c ft_ultoa_base.c
SRCS = ft_contain_only.c ft_freer.c ft_is_in.c ft_random_generator.c ft_strchri.c ft_strcmp.c ft_strfjoin.c ft_strgen.c ft_strmerger.c ft_strndup.c ft_tabrealloc.c ft_ultoa_base.c ft_swap.c
OBJS = $(SRCS:.c=.o)

Binary file not shown.

View File

@ -28,9 +28,13 @@ char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...);
int ft_is_in(char *str, char c);
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size);
char *ft_strndup(char *src, size_t n);
char *ft_strndup(const char *src, size_t n);
ssize_t ft_strchri(char *str, char c);
int ft_contain_only_str(char *str, char *to_find);
int ft_contain_only(char *str, char c);
int ft_strcmp(char *s1, char *s2);
void ft_swap(void *a, void *b);
void ft_swap_int(int *a, int *b);
void ft_swap_char(char *a, char *b);
#endif

View File

@ -12,7 +12,7 @@
#include "extra.h"
char *ft_strndup(char *src, size_t n)
char *ft_strndup(const char *src, size_t n)
{
char *out;
size_t i;

Binary file not shown.

28
libftx/extra/ft_swap.c Normal file
View File

@ -0,0 +1,28 @@
#include "utils.h"
void ft_swap(void *a, void *b)
{
void *c;
c = a;
a = b;
b = c;
}
void ft_swap_char(char *a, char *b)
{
char c;
c = *a;
*a = *b;
*b = c;
}
void ft_swap_int(int *a, int *b)
{
int c;
c = *a;
*a = *b;
*b = c;
}

BIN
libftx/extra/ft_swap.o Normal file

Binary file not shown.

View File

@ -45,9 +45,8 @@ SRCS = ft_isalpha.c \
ft_putchar_fd.c \
ft_putstr_fd.c \
ft_putendl_fd.c \
ft_putnbr_fd.c
BSRCS = ft_lstnew.c \
ft_putnbr_fd.c \
ft_lstnew.c \
ft_lstadd_front.c \
ft_lstsize.c \
ft_lstlast.c \
@ -59,8 +58,6 @@ BSRCS = ft_lstnew.c \
OBJS = $(SRCS:.c=.o)
BOBJS = $(BSRCS:.c=.o)
NAME = libft.a
CFLAGS = -Wall -Werror -Wextra -g
@ -73,15 +70,12 @@ all: $(NAME)
$(NAME): $(OBJS)
ar -rc $(NAME) $(OBJS)
bonus: $(OBJS) $(BOBJS)
ar -rc $(NAME) $(OBJS) $(BOBJS)
clean:
rm -f $(OBJS) $(BOBJS)
rm -f $(OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all bonus clean fclean re
.PHONY: all clean fclean re

Binary file not shown.

Binary file not shown.

BIN
libftx/libft/ft_lstclear.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstdelone.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstiter.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstlast.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstmap.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstnew.o Normal file

Binary file not shown.

BIN
libftx/libft/ft_lstsize.o Normal file

Binary file not shown.

View File

@ -68,7 +68,7 @@ static char **ft_segsplitter(char **tab, size_t len, const char *s, char c)
let_index++;
tab[tab_index] = ft_substr(s, start, let_index - start);
if (tab[tab_index] == NULL)
return (ft_cancel(tab, tab_index));
return (ft_cancel((void **)tab, tab_index));
tab_index++;
}
return (tab);

Binary file not shown.

Binary file not shown.

View File

@ -15,7 +15,7 @@
# include <stdlib.h>
# include <unistd.h>
void *ft_cancel(char **tab, size_t len);
void *ft_cancel(void **tab, size_t len);
int ft_atoi(const char *nptr);
void ft_bzero(void *s, size_t n);
void *ft_calloc(size_t nmemb, size_t size);

Binary file not shown.

View File

@ -32,7 +32,10 @@ char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...);
int ft_strcmp(char *s1, char *s2);
ssize_t ft_strchri(char *str, char c);
char *ft_strndup(char *src, size_t n);
char *ft_strndup(const char *src, size_t n);
void ft_swap(void *a, void *b);
void ft_swap_int(int *a, int *b);
void ft_swap_char(char *a, char *b);
void *ft_cancel(void **tab, size_t len);
int ft_atoi(const char *nptr);