diff options
Diffstat (limited to 'libft')
-rw-r--r-- | libft/src/ft_substr.c | 3 | ||||
-rw-r--r-- | libft/src/ft_tolower.c | 6 | ||||
-rw-r--r-- | libft/src/ft_toupper.c | 6 | ||||
-rw-r--r-- | libft/src/ft_uintlen.c | 5 | ||||
-rw-r--r-- | libft/src/ft_uintlen_base.c | 5 | ||||
-rw-r--r-- | libft/src/ft_uitoa.c | 2 | ||||
-rw-r--r-- | libft/src/ft_uitoa_base.c | 5 | ||||
-rw-r--r-- | libft/src/ft_uitoa_s.c | 2 | ||||
-rw-r--r-- | libft/src/get_next_line.c | 13 | ||||
-rw-r--r-- | libft/src/get_next_line_utils.c | 15 |
10 files changed, 23 insertions, 39 deletions
diff --git a/libft/src/ft_substr.c b/libft/src/ft_substr.c index 234ddc4..271f34f 100644 --- a/libft/src/ft_substr.c +++ b/libft/src/ft_substr.c @@ -14,8 +14,7 @@ #include <stdlib.h> #include <stddef.h> -char - *ft_substr(const char *s, unsigned int start, size_t len) +char *ft_substr(const char *s, unsigned int start, size_t len) { char *nstr; diff --git a/libft/src/ft_tolower.c b/libft/src/ft_tolower.c index 1877dbb..91ed9ee 100644 --- a/libft/src/ft_tolower.c +++ b/libft/src/ft_tolower.c @@ -10,16 +10,14 @@ /* */ /* ************************************************************************** */ -static int - ft_isupper(int c) +static int ft_isupper(int c) { if (c >= 65 && c <= 90) return (1); return (0); } -int - ft_tolower(int c) +int ft_tolower(int c) { if (ft_isupper(c)) return (c + 32); diff --git a/libft/src/ft_toupper.c b/libft/src/ft_toupper.c index 864ef70..62365c5 100644 --- a/libft/src/ft_toupper.c +++ b/libft/src/ft_toupper.c @@ -10,16 +10,14 @@ /* */ /* ************************************************************************** */ -static int - ft_islower(int c) +static int ft_islower(int c) { if (c >= 97 && c <= 122) return (1); return (0); } -int - ft_toupper(int c) +int ft_toupper(int c) { if (ft_islower(c)) return (c - 32); diff --git a/libft/src/ft_uintlen.c b/libft/src/ft_uintlen.c index da5be7b..990e36c 100644 --- a/libft/src/ft_uintlen.c +++ b/libft/src/ft_uintlen.c @@ -12,13 +12,12 @@ #include <inttypes.h> -uint8_t - ft_uintlen(unsigned long n) +uint8_t ft_uintlen(unsigned long n) { uint8_t len; len = 0; - if (!n) + if (n == 0) return (1); while (n != 0) { diff --git a/libft/src/ft_uintlen_base.c b/libft/src/ft_uintlen_base.c index ba96a29..a695c3f 100644 --- a/libft/src/ft_uintlen_base.c +++ b/libft/src/ft_uintlen_base.c @@ -13,15 +13,14 @@ #include <libft.h> #include <inttypes.h> -uint8_t - ft_uintlen_base(unsigned long n, char *base) +uint8_t ft_uintlen_base(unsigned long n, char *base) { uint8_t len; uint8_t size; size = ft_strlen(base); len = 0; - if (!n) + if (n == 0) return (1); while (n != 0) { diff --git a/libft/src/ft_uitoa.c b/libft/src/ft_uitoa.c index cc41d91..a9d76c4 100644 --- a/libft/src/ft_uitoa.c +++ b/libft/src/ft_uitoa.c @@ -23,7 +23,7 @@ char *ft_uitoa(unsigned long n) i = ft_uintlen(n) - 1; if (!(s = (char*)malloc((i + 2) * sizeof(char)))) return (NULL); - if (!n) + if (n == 0) s[i] = '0'; nb = n; s[i + 1] = '\0'; diff --git a/libft/src/ft_uitoa_base.c b/libft/src/ft_uitoa_base.c index a931d29..fd9e9a4 100644 --- a/libft/src/ft_uitoa_base.c +++ b/libft/src/ft_uitoa_base.c @@ -13,8 +13,7 @@ #include <libft.h> #include <stdlib.h> -char - *ft_uitoa_base(unsigned long n, char *base) +char *ft_uitoa_base(unsigned long n, char *base) { char *s; unsigned long nb; @@ -23,7 +22,7 @@ char i = ft_uintlen_base(n, base) - 1; if (!(s = (char*)malloc((i + 2) * sizeof(char)))) return (NULL); - if (!n) + if (n == 0) s[i] = '0'; s[i + 1] = '\0'; while (n > 0) diff --git a/libft/src/ft_uitoa_s.c b/libft/src/ft_uitoa_s.c index e030c34..352922d 100644 --- a/libft/src/ft_uitoa_s.c +++ b/libft/src/ft_uitoa_s.c @@ -19,7 +19,7 @@ void ft_uitoa_s(char str[], unsigned long n) uint8_t i; i = ft_uintlen(n) - 1; - if (!n) + if (n == 0) str[i] = '0'; nb = n; str[i + 1] = '\0'; diff --git a/libft/src/get_next_line.c b/libft/src/get_next_line.c index 2b2ba80..032ad95 100644 --- a/libft/src/get_next_line.c +++ b/libft/src/get_next_line.c @@ -16,8 +16,7 @@ #include <stdint.h> #include <unistd.h> -static char - *ft_strjoin_gnl(char *s1, char *s2) +static char *ft_strjoin_gnl(char *s1, char *s2) { size_t i; size_t j; @@ -40,14 +39,13 @@ static char return (dst); } -static int - ft_read_gnl(int fd, char **line, t_gnl *curr) +static int ft_read_gnl(int fd, char **line, t_gnl *curr) { char *buf; char *end; int64_t size; - if (!(buf = malloc(BUFFER_SIZE + 1))) + if ((buf = malloc(BUFFER_SIZE + 1)) == NULL) return (-1); *buf = 0; *line = ft_strjoin_gnl(*line, curr->rest); @@ -70,8 +68,7 @@ static int return (size); } -int - get_next_line(int fd, char **line) +int get_next_line(int fd, char **line) { static t_gnl *list; t_gnl *curr; @@ -80,7 +77,7 @@ int if (fd < 0 || BUFFER_SIZE <= 0) return (-1); - if (!(*line = (char *)malloc(1 * sizeof(char)))) + if ((*line = (char *)malloc(1 * sizeof(char))) == NULL) return (-1); **line = 0; curr = ft_find_fd(fd, &list); diff --git a/libft/src/get_next_line_utils.c b/libft/src/get_next_line_utils.c index 5181808..6e0cfaa 100644 --- a/libft/src/get_next_line_utils.c +++ b/libft/src/get_next_line_utils.c @@ -14,8 +14,7 @@ #include <stdlib.h> #include <stddef.h> -size_t - ft_strlen_gnl(const char *s, char c) +size_t ft_strlen_gnl(const char *s, char c) { size_t i; @@ -27,8 +26,7 @@ size_t return (i); } -int - ft_free_gnl(int fd, t_gnl **list) +int ft_free_gnl(int fd, t_gnl **list) { t_gnl *scout; t_gnl *prev; @@ -54,8 +52,7 @@ int return (0); } -t_gnl - *ft_find_fd(int fd, t_gnl **list) +t_gnl *ft_find_fd(int fd, t_gnl **list) { t_gnl *curr; t_gnl *new; @@ -82,8 +79,7 @@ t_gnl return (curr); } -char - *ft_strchr_gnl(const char *s, int c) +char *ft_strchr_gnl(const char *s, int c) { unsigned int i; @@ -98,8 +94,7 @@ char return ((char *)s + i); } -char - *ft_swap_gnl(char *s1, char *free_ft) +char *ft_swap_gnl(char *s1, char *free_ft) { char *dst; int i; |