correct some errors
This commit is contained in:
parent
e062e9e985
commit
fd457ff351
16
src/Makefile
16
src/Makefile
@ -11,18 +11,23 @@
|
||||
# **************************************************************************** #
|
||||
|
||||
NAME = libft.a
|
||||
|
||||
SOURCES = ft_atoi.c ft_bzero.c ft_calloc.c ft_isalnum.c ft_isalpha.c \
|
||||
ft_isascii.c ft_isdigit.c ft_isprint.c ft_itoa.c ft_lstadd_back.c\
|
||||
ft_lstadd_front.c ft_lstclear.c ft_lstdelone.c ft_lstiter.c \
|
||||
ft_lstlast.c ft_lstmap.c ft_lstnew.c ft_lstsize.c ft_memchr.c \
|
||||
ft_isascii.c ft_isdigit.c ft_isprint.c ft_itoa.c ft_memchr.c \
|
||||
ft_memcmp.c ft_memcpy.c ft_memmove.c ft_memset.c ft_putchar_fd.c \
|
||||
ft_putendl_fd.c ft_putnbr_fd.c ft_putstr_fd.c ft_split.c ft_strchr.c \
|
||||
ft_strdup.c ft_striteri.c ft_strjoin.c ft_strlcat.c ft_strlcpy.c \
|
||||
ft_strlen.c ft_strmapi.c ft_strncmp.c ft_strnstr.c ft_strrchr.c \
|
||||
ft_strtrim.c ft_substr.c ft_tolower.c ft_toupper.c
|
||||
|
||||
BONUS_SOURCES = ft_lstadd_back.c ft_lstadd_front.c ft_lstclear.c \
|
||||
ft_lstdelone.c ft_lstiter.c ft_lstlast.c ft_lstmap.c \
|
||||
ft_lstnew.c ft_lstsize.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
BONUS_OBJECTS = $(BONUS_SOURCES:.c=.o)
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -Werror
|
||||
|
||||
@ -31,11 +36,14 @@ all: $(NAME)
|
||||
$(NAME): $(OBJECTS)
|
||||
$(AR) -r $@ $?
|
||||
|
||||
bonus: $(OBJECTS) $(BONUS_OBJECTS)
|
||||
$(AR) -r $(NAME) $?
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) $?
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) $(BOBJECTS)
|
||||
rm -f $(OBJECTS) $(BONUS_OBJECTS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
@ -28,7 +28,7 @@ int ft_atoi(const char *nptr)
|
||||
nptr++;
|
||||
res = 0;
|
||||
sign = 1;
|
||||
while (*nptr == '-' || *nptr == '+')
|
||||
if (*nptr == '-' || *nptr == '+')
|
||||
{
|
||||
if (*nptr == '-')
|
||||
sign *= -1;
|
||||
|
||||
@ -17,6 +17,10 @@ void *ft_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (nmemb && nmemb > (size_t) -1 / nmemb)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
ptr = malloc(nmemb * size);
|
||||
if (ptr)
|
||||
ft_bzero(ptr, nmemb * size);
|
||||
|
||||
@ -18,7 +18,7 @@ char *ft_strnstr(const char *big, const char *little, size_t len)
|
||||
size_t j;
|
||||
|
||||
i = 0;
|
||||
if (*little == '\0' || len == 0)
|
||||
if (*little == '\0')
|
||||
return ((char *) big);
|
||||
while (big[i] && i < len)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user