diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-10-27 19:59:20 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-10-27 19:59:20 +0100 |
commit | c5aae008dee36276154882d8fd56c3bdeb473474 (patch) | |
tree | a40740914847ebf39a5f8cb3acf6a48c8b9d61ef /libft | |
parent | TODO update (diff) | |
download | 42-minishell-c5aae008dee36276154882d8fd56c3bdeb473474.tar.gz 42-minishell-c5aae008dee36276154882d8fd56c3bdeb473474.tar.bz2 42-minishell-c5aae008dee36276154882d8fd56c3bdeb473474.tar.xz 42-minishell-c5aae008dee36276154882d8fd56c3bdeb473474.tar.zst 42-minishell-c5aae008dee36276154882d8fd56c3bdeb473474.zip |
Now norme
Diffstat (limited to 'libft')
-rw-r--r-- | libft/include/libft.h | 35 | ||||
-rw-r--r-- | libft/src/ft_atoi.c | 13 | ||||
-rw-r--r-- | libft/src/ft_intlen.c | 5 | ||||
-rw-r--r-- | libft/src/ft_intlen_base.c | 7 | ||||
-rw-r--r-- | libft/src/ft_ischarset.c | 1 | ||||
-rw-r--r-- | libft/src/ft_itoa.c | 3 | ||||
-rw-r--r-- | libft/src/ft_itoa_base.c | 3 | ||||
-rw-r--r-- | libft/src/ft_itoa_s.c | 3 | ||||
-rw-r--r-- | libft/src/ft_printf_process.c | 1 | ||||
-rw-r--r-- | libft/src/ft_printf_put_char.c | 1 | ||||
-rw-r--r-- | libft/src/ft_printf_put_hex.c | 3 | ||||
-rw-r--r-- | libft/src/ft_printf_put_int.c | 5 | ||||
-rw-r--r-- | libft/src/ft_printf_put_ptr.c | 1 | ||||
-rw-r--r-- | libft/src/ft_printf_put_str.c | 1 | ||||
-rw-r--r-- | libft/src/ft_printf_treat_flags.c | 2 | ||||
-rw-r--r-- | libft/src/ft_putnbr.c | 1 | ||||
-rw-r--r-- | libft/src/ft_putnbr_base.c | 3 | ||||
-rw-r--r-- | libft/src/ft_split.c | 3 | ||||
-rw-r--r-- | libft/src/ft_strnstr.c | 1 | ||||
-rw-r--r-- | libft/src/ft_strsubst_s.c | 3 | ||||
-rw-r--r-- | libft/src/ft_uintlen.c | 5 | ||||
-rw-r--r-- | libft/src/ft_uintlen_base.c | 7 | ||||
-rw-r--r-- | libft/src/ft_uitoa.c | 3 | ||||
-rw-r--r-- | libft/src/ft_uitoa_base.c | 2 | ||||
-rw-r--r-- | libft/src/ft_uitoa_s.c | 3 | ||||
-rw-r--r-- | libft/src/get_next_line.c | 3 |
26 files changed, 47 insertions, 71 deletions
diff --git a/libft/include/libft.h b/libft/include/libft.h index 6f3f523..7f71a18 100644 --- a/libft/include/libft.h +++ b/libft/include/libft.h @@ -15,7 +15,6 @@ # include <stddef.h> # include <stdarg.h> -# include <stdint.h> # define FT_MIN_HEX_BASE "0123456789abcdef" # define FT_MAJ_HEX_BASE "0123456789ABCDEF" @@ -52,15 +51,15 @@ typedef struct s_printflist int width; int precision; int fulllen; - uint8_t isreverse; - uint8_t isneg; - uint8_t isaz; - uint8_t zflag; - uint8_t issharp; - uint8_t isminus; - int8_t isaspace; - uint8_t isaplus; - int8_t lh; + unsigned char isreverse; + unsigned char isneg; + unsigned char isaz; + unsigned char zflag; + unsigned char issharp; + unsigned char isminus; + char isaspace; + unsigned char isaplus; + char lh; char conv; char actconv; } t_printflist; @@ -69,8 +68,8 @@ typedef struct s_stok { char *spanp; char *ns; - int32_t c; - int32_t sc; + int c; + int sc; } t_stok; /* @@ -125,7 +124,7 @@ char *ft_nstr(size_t size); char *ft_strsubst(char *str, const char *pattern, const char *subst); -int8_t ft_strsubst_s(char *str, +char ft_strsubst_s(char *str, const char *pattern, const char *subst); char *ft_strtok_r(char *s, const char *delim, char **last); @@ -136,10 +135,10 @@ char **ft_split(const char *s, char c); ** INT */ -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); +unsigned char ft_intlen(long n); +unsigned char ft_intlen_base(long n, char *base); +unsigned char ft_uintlen(unsigned long n); +unsigned char ft_uintlen_base(unsigned long n, char *base); int ft_memcmp(const void *s1, const void *s2, size_t n); t_bool ft_isspace(int c); t_bool ft_iswhitespace(int c); @@ -223,7 +222,7 @@ char *ft_printf_get_flags(const char *format, char *ft_printf_flag_to_atoi(char *str); char *ft_printf_get_width_nstr(char *str, t_printflist *pflist); -uint8_t ft_printf_is_multiwrite(const char *format); +unsigned char ft_printf_is_multiwrite(const char *format); int ft_printf_flags(const char *format, int pos, va_list arg, diff --git a/libft/src/ft_atoi.c b/libft/src/ft_atoi.c index e0178db..ea6189c 100644 --- a/libft/src/ft_atoi.c +++ b/libft/src/ft_atoi.c @@ -11,11 +11,10 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> -static int8_t ft_setsign(const char c) +static char ft_setsign(const char c) { - int8_t sign; + char sign; sign = 1; if (c == '-') @@ -25,9 +24,9 @@ static int8_t ft_setsign(const char c) return (sign); } -static uint8_t ft_seti(const char *str) +static unsigned char ft_seti(const char *str) { - uint8_t i; + unsigned char i; i = 0; while (ft_isspace(str[i]) == TRUE) @@ -39,8 +38,8 @@ static uint8_t ft_seti(const char *str) int ft_atoi(const char *str) { - uint8_t i; - int8_t sign; + unsigned char i; + char sign; long nb; i = ft_seti(str); diff --git a/libft/src/ft_intlen.c b/libft/src/ft_intlen.c index 76d2e4f..a98f2a4 100644 --- a/libft/src/ft_intlen.c +++ b/libft/src/ft_intlen.c @@ -10,11 +10,10 @@ /* */ /* ************************************************************************** */ -#include <inttypes.h> -uint8_t ft_intlen(long n) +unsigned char ft_intlen(long n) { - uint8_t len; + unsigned char len; len = 0; if (n == 0) diff --git a/libft/src/ft_intlen_base.c b/libft/src/ft_intlen_base.c index 99c0ff2..3982b5f 100644 --- a/libft/src/ft_intlen_base.c +++ b/libft/src/ft_intlen_base.c @@ -11,12 +11,11 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> -uint8_t ft_intlen_base(long n, char *base) +unsigned char ft_intlen_base(long n, char *base) { - uint8_t len; - uint8_t size; + unsigned char len; + unsigned char size; size = ft_strlen(base); len = 0; diff --git a/libft/src/ft_ischarset.c b/libft/src/ft_ischarset.c index 82d3445..cbe408b 100644 --- a/libft/src/ft_ischarset.c +++ b/libft/src/ft_ischarset.c @@ -12,7 +12,6 @@ #include <libft.h> #include <stddef.h> -#include <inttypes.h> t_bool ft_ischarset(const char *charset, int c) { diff --git a/libft/src/ft_itoa.c b/libft/src/ft_itoa.c index 2c0c14e..a243719 100644 --- a/libft/src/ft_itoa.c +++ b/libft/src/ft_itoa.c @@ -11,14 +11,13 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> #include <stdlib.h> char *ft_itoa(long n) { char *s; long nb; - uint8_t i; + unsigned char i; i = ft_intlen(n) - 1; if ((s = (char*)malloc((i + 2) * sizeof(char))) == NULL) diff --git a/libft/src/ft_itoa_base.c b/libft/src/ft_itoa_base.c index 2537161..091b47c 100644 --- a/libft/src/ft_itoa_base.c +++ b/libft/src/ft_itoa_base.c @@ -11,14 +11,13 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> #include <stdlib.h> char *ft_itoa_base(long n, char *base) { char *s; long nb; - uint8_t i; + unsigned char i; i = ft_intlen_base(n, base) - 1; if ((s = (char*)malloc((i + 2) * sizeof(char))) == NULL) diff --git a/libft/src/ft_itoa_s.c b/libft/src/ft_itoa_s.c index a3469f3..98088e3 100644 --- a/libft/src/ft_itoa_s.c +++ b/libft/src/ft_itoa_s.c @@ -11,12 +11,11 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> void ft_itoa_s(char str[], long n) { long nb; - uint8_t i; + unsigned char i; i = ft_intlen(n) - 1; if (n == 0) diff --git a/libft/src/ft_printf_process.c b/libft/src/ft_printf_process.c index d6ecd88..c7df2e5 100644 --- a/libft/src/ft_printf_process.c +++ b/libft/src/ft_printf_process.c @@ -13,7 +13,6 @@ #include <libft.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> #include <limits.h> /* diff --git a/libft/src/ft_printf_put_char.c b/libft/src/ft_printf_put_char.c index 42d8212..bf94ddb 100644 --- a/libft/src/ft_printf_put_char.c +++ b/libft/src/ft_printf_put_char.c @@ -14,7 +14,6 @@ #include <stddef.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> #include <unistd.h> void ft_printf_put_c(va_list arg, t_printflist *pflist) diff --git a/libft/src/ft_printf_put_hex.c b/libft/src/ft_printf_put_hex.c index 546c4fa..6f7090c 100644 --- a/libft/src/ft_printf_put_hex.c +++ b/libft/src/ft_printf_put_hex.c @@ -14,9 +14,8 @@ #include <stddef.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> -static unsigned long ft_printf_get_xlh(va_list arg, int8_t lh, uint8_t zflag) +static unsigned long ft_printf_get_xlh(va_list arg, char lh, unsigned char zflag) { if (zflag == 1) return (va_arg(arg, size_t)); diff --git a/libft/src/ft_printf_put_int.c b/libft/src/ft_printf_put_int.c index 774fe71..c40c669 100644 --- a/libft/src/ft_printf_put_int.c +++ b/libft/src/ft_printf_put_int.c @@ -14,9 +14,8 @@ #include <stddef.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> -static long ft_printf_get_dlh(va_list arg, int8_t lh) +static long ft_printf_get_dlh(va_list arg, char lh) { if (lh == 0) return (va_arg(arg, int)); @@ -31,7 +30,7 @@ static long ft_printf_get_dlh(va_list arg, int8_t lh) return (va_arg(arg, int)); } -static unsigned long ft_printf_get_ulh(va_list arg, int8_t lh, uint8_t zflag) +static unsigned long ft_printf_get_ulh(va_list arg, char lh, unsigned char zflag) { if (zflag == 1) return (va_arg(arg, size_t)); diff --git a/libft/src/ft_printf_put_ptr.c b/libft/src/ft_printf_put_ptr.c index ba526d1..afd727f 100644 --- a/libft/src/ft_printf_put_ptr.c +++ b/libft/src/ft_printf_put_ptr.c @@ -13,7 +13,6 @@ #include <libft.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> /* ** For GCC: if (!p) { ft_putstr("(nil)"); return ; } diff --git a/libft/src/ft_printf_put_str.c b/libft/src/ft_printf_put_str.c index ba38211..546b26b 100644 --- a/libft/src/ft_printf_put_str.c +++ b/libft/src/ft_printf_put_str.c @@ -13,7 +13,6 @@ #include <libft.h> #include <stdlib.h> #include <stdarg.h> -#include <inttypes.h> void ft_printf_put_s(va_list arg, t_printflist *pflist) { diff --git a/libft/src/ft_printf_treat_flags.c b/libft/src/ft_printf_treat_flags.c index 436f786..abebc0d 100644 --- a/libft/src/ft_printf_treat_flags.c +++ b/libft/src/ft_printf_treat_flags.c @@ -94,7 +94,7 @@ static void ft_printf_get_lh(t_printflist *pflist) } } -static uint8_t ft_printf_check_z(t_printflist *pflist) +static unsigned char ft_printf_check_z(t_printflist *pflist) { char *ptr; diff --git a/libft/src/ft_putnbr.c b/libft/src/ft_putnbr.c index cd6bf9b..e93c75b 100644 --- a/libft/src/ft_putnbr.c +++ b/libft/src/ft_putnbr.c @@ -12,7 +12,6 @@ #include <libft.h> #include <unistd.h> -#include <inttypes.h> void ft_putnbr(long nb) { diff --git a/libft/src/ft_putnbr_base.c b/libft/src/ft_putnbr_base.c index 3468b6b..86c0539 100644 --- a/libft/src/ft_putnbr_base.c +++ b/libft/src/ft_putnbr_base.c @@ -11,12 +11,11 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> void ft_putnbr_base(long nb, char *base) { long i; - uint8_t size; + unsigned char size; i = nb; size = ft_strlen(base); diff --git a/libft/src/ft_split.c b/libft/src/ft_split.c index a5e1189..69aeefe 100644 --- a/libft/src/ft_split.c +++ b/libft/src/ft_split.c @@ -13,13 +13,12 @@ #include <libft.h> #include <stddef.h> #include <stdlib.h> -#include <inttypes.h> static size_t ft_count_words(const char *s, char c) { size_t i; size_t count; - uint8_t ibool; + unsigned char ibool; i = 0; count = 0; diff --git a/libft/src/ft_strnstr.c b/libft/src/ft_strnstr.c index 615320e..eabadfb 100644 --- a/libft/src/ft_strnstr.c +++ b/libft/src/ft_strnstr.c @@ -12,7 +12,6 @@ #include <libft.h> #include <stddef.h> -#include <inttypes.h> char *ft_strnstr(const char *haystack, const char *needle, size_t len) { diff --git a/libft/src/ft_strsubst_s.c b/libft/src/ft_strsubst_s.c index 9e43907..0805ceb 100644 --- a/libft/src/ft_strsubst_s.c +++ b/libft/src/ft_strsubst_s.c @@ -11,10 +11,9 @@ /* ************************************************************************** */ #include <libft.h> -#include <stdint.h> #include <stdlib.h> -int8_t ft_strsubst_s(char *str, const char *pattern, const char *subst) +char ft_strsubst_s(char *str, const char *pattern, const char *subst) { char *ptr; diff --git a/libft/src/ft_uintlen.c b/libft/src/ft_uintlen.c index 990e36c..ef4651a 100644 --- a/libft/src/ft_uintlen.c +++ b/libft/src/ft_uintlen.c @@ -10,11 +10,10 @@ /* */ /* ************************************************************************** */ -#include <inttypes.h> -uint8_t ft_uintlen(unsigned long n) +unsigned char ft_uintlen(unsigned long n) { - uint8_t len; + unsigned char len; len = 0; if (n == 0) diff --git a/libft/src/ft_uintlen_base.c b/libft/src/ft_uintlen_base.c index a695c3f..2afcb2e 100644 --- a/libft/src/ft_uintlen_base.c +++ b/libft/src/ft_uintlen_base.c @@ -11,12 +11,11 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> -uint8_t ft_uintlen_base(unsigned long n, char *base) +unsigned char ft_uintlen_base(unsigned long n, char *base) { - uint8_t len; - uint8_t size; + unsigned char len; + unsigned char size; size = ft_strlen(base); len = 0; diff --git a/libft/src/ft_uitoa.c b/libft/src/ft_uitoa.c index a9d76c4..9a58b32 100644 --- a/libft/src/ft_uitoa.c +++ b/libft/src/ft_uitoa.c @@ -11,14 +11,13 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> #include <stdlib.h> char *ft_uitoa(unsigned long n) { char *s; unsigned long nb; - uint8_t i; + unsigned char i; i = ft_uintlen(n) - 1; if (!(s = (char*)malloc((i + 2) * sizeof(char)))) diff --git a/libft/src/ft_uitoa_base.c b/libft/src/ft_uitoa_base.c index fd9e9a4..81f9f4c 100644 --- a/libft/src/ft_uitoa_base.c +++ b/libft/src/ft_uitoa_base.c @@ -17,7 +17,7 @@ char *ft_uitoa_base(unsigned long n, char *base) { char *s; unsigned long nb; - uint8_t i; + unsigned char i; i = ft_uintlen_base(n, base) - 1; if (!(s = (char*)malloc((i + 2) * sizeof(char)))) diff --git a/libft/src/ft_uitoa_s.c b/libft/src/ft_uitoa_s.c index 352922d..3a840f5 100644 --- a/libft/src/ft_uitoa_s.c +++ b/libft/src/ft_uitoa_s.c @@ -11,12 +11,11 @@ /* ************************************************************************** */ #include <libft.h> -#include <inttypes.h> void ft_uitoa_s(char str[], unsigned long n) { unsigned long nb; - uint8_t i; + unsigned char i; i = ft_uintlen(n) - 1; if (n == 0) diff --git a/libft/src/get_next_line.c b/libft/src/get_next_line.c index 032ad95..59b650f 100644 --- a/libft/src/get_next_line.c +++ b/libft/src/get_next_line.c @@ -13,7 +13,6 @@ #include <libft.h> #include <stdlib.h> #include <stddef.h> -#include <stdint.h> #include <unistd.h> static char *ft_strjoin_gnl(char *s1, char *s2) @@ -43,7 +42,7 @@ static int ft_read_gnl(int fd, char **line, t_gnl *curr) { char *buf; char *end; - int64_t size; + long size; if ((buf = malloc(BUFFER_SIZE + 1)) == NULL) return (-1); |