diff options
Diffstat (limited to 'libft')
-rw-r--r-- | libft/include/libft.h | 16 | ||||
-rw-r--r-- | libft/src/ft_isalnum.c | 6 | ||||
-rw-r--r-- | libft/src/ft_isalpha.c | 20 | ||||
-rw-r--r-- | libft/src/ft_isascii.c | 8 | ||||
-rw-r--r-- | libft/src/ft_ischarset.c | 6 | ||||
-rw-r--r-- | libft/src/ft_isdigit.c | 8 | ||||
-rw-r--r-- | libft/src/ft_isprint.c | 8 | ||||
-rw-r--r-- | libft/src/ft_isspace.c | 7 |
8 files changed, 45 insertions, 34 deletions
diff --git a/libft/include/libft.h b/libft/include/libft.h index 0cd5ed1..7019d6b 100644 --- a/libft/include/libft.h +++ b/libft/include/libft.h @@ -121,18 +121,20 @@ char **ft_split(const char *s, char c); ** INT */ -uint8_t ft_isspace(int c); -uint8_t ft_ischarset(const char *charset, int c); uint8_t ft_intlen(long n); uint8_t ft_intlen_base(long n, char *base); uint8_t ft_uintlen(unsigned long n); uint8_t ft_uintlen_base(unsigned long n, char *base); int ft_memcmp(const void *s1, const void *s2, size_t n); -int ft_isalpha(int c); -int ft_isdigit(int c); -int ft_isalnum(int c); -int ft_isascii(int c); -int ft_isprint(int c); +t_bool ft_isspace(int c); +t_bool ft_ischarset(const char *charset, int c); +t_bool ft_isupper(int c); +t_bool ft_islower(int c); +t_bool ft_isalpha(int c); +t_bool ft_isdigit(int c); +t_bool ft_isalnum(int c); +t_bool ft_isascii(int c); +t_bool ft_isprint(int c); int ft_toupper(int c); int ft_tolower(int c); int ft_strncmp(const char *s1, const char *s2, size_t n); diff --git a/libft/src/ft_isalnum.c b/libft/src/ft_isalnum.c index e764ac6..fca042d 100644 --- a/libft/src/ft_isalnum.c +++ b/libft/src/ft_isalnum.c @@ -12,10 +12,10 @@ #include <libft.h> -int +t_bool ft_isalnum(int c) { if (ft_isalpha(c) || ft_isdigit(c)) - return (1); - return (0); + return (TRUE); + return (FALSE); } diff --git a/libft/src/ft_isalpha.c b/libft/src/ft_isalpha.c index 562825d..3b7a88f 100644 --- a/libft/src/ft_isalpha.c +++ b/libft/src/ft_isalpha.c @@ -10,26 +10,28 @@ /* */ /* ************************************************************************** */ -static int +#include <libft.h> + +t_bool ft_isupper(int c) { if (c >= 65 && c <= 90) - return (1); - return (0); + return (TRUE); + return (FALSE); } -static int +t_bool ft_islower(int c) { if (c >= 97 && c <= 122) - return (1); - return (0); + return (TRUE); + return (FALSE); } -int +t_bool ft_isalpha(int c) { if (ft_isupper(c) || ft_islower(c)) - return (1); - return (0); + return (TRUE); + return (FALSE); } diff --git a/libft/src/ft_isascii.c b/libft/src/ft_isascii.c index 8d2f3f2..04e63c3 100644 --- a/libft/src/ft_isascii.c +++ b/libft/src/ft_isascii.c @@ -10,10 +10,12 @@ /* */ /* ************************************************************************** */ -int +#include <libft.h> + +t_bool ft_isascii(int c) { if (c >= 0 && c <= 127) - return (1); - return (0); + return (TRUE); + return (FALSE); } diff --git a/libft/src/ft_ischarset.c b/libft/src/ft_ischarset.c index 95b9172..eb57d87 100644 --- a/libft/src/ft_ischarset.c +++ b/libft/src/ft_ischarset.c @@ -14,7 +14,7 @@ #include <stddef.h> #include <inttypes.h> -uint8_t +t_bool ft_ischarset(const char *charset, int c) { size_t i; @@ -23,8 +23,8 @@ uint8_t while (charset[i]) { if (charset[i] == c) - return (1); + return (TRUE); i++; } - return (0); + return (FALSE); } diff --git a/libft/src/ft_isdigit.c b/libft/src/ft_isdigit.c index ebe1f40..3c73f92 100644 --- a/libft/src/ft_isdigit.c +++ b/libft/src/ft_isdigit.c @@ -10,10 +10,12 @@ /* */ /* ************************************************************************** */ -int +#include <libft.h> + +t_bool ft_isdigit(int c) { if (c >= 48 && c <= 57) - return (1); - return (0); + return (TRUE); + return (FALSE); } diff --git a/libft/src/ft_isprint.c b/libft/src/ft_isprint.c index 12fdb7a..f4d1b73 100644 --- a/libft/src/ft_isprint.c +++ b/libft/src/ft_isprint.c @@ -10,10 +10,12 @@ /* */ /* ************************************************************************** */ -int +#include <libft.h> + +t_bool ft_isprint(int c) { if (c >= 32 && c <= 126) - return (1); - return (0); + return (TRUE); + return (FALSE); } diff --git a/libft/src/ft_isspace.c b/libft/src/ft_isspace.c index 188e94a..b9b653f 100644 --- a/libft/src/ft_isspace.c +++ b/libft/src/ft_isspace.c @@ -10,9 +10,10 @@ /* */ /* ************************************************************************** */ +#include <libft.h> #include <inttypes.h> -uint8_t +t_bool ft_isspace(int c) { if (c == '\t' || @@ -21,6 +22,6 @@ uint8_t c == '\f' || c == '\r' || c == ' ') - return (1); - return (0); + return (TRUE); + return (FALSE); } |