aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-17 10:56:16 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-17 10:56:16 +0100
commitfe37597119353ce183fc404417b81bd4702f64b7 (patch)
treefaa20a8352092c062e2fd272fff2104d9f2ddb3f /src
parent2e5ca2ab6276b7b24895ade28e1533356ef523dc (diff)
downloadlibft-fe37597119353ce183fc404417b81bd4702f64b7.tar.gz
libft-fe37597119353ce183fc404417b81bd4702f64b7.tar.bz2
libft-fe37597119353ce183fc404417b81bd4702f64b7.zip
Splited include like src/, Adding feature toggle protection in header
Diffstat (limited to 'src')
-rw-r--r--src/io/ft_get_next_line.c (renamed from src/io/get_next_line/get_next_line.c)18
-rw-r--r--src/io/ft_printf.c24
-rw-r--r--src/io/ft_printf/ft_asprintf.c (renamed from src/io/ft_asprintf.c)0
-rw-r--r--src/io/ft_printf/ft_dprintf.c (renamed from src/io/ft_dprintf.c)0
-rw-r--r--src/io/ft_printf/ft_printf.c88
-rw-r--r--src/io/ft_printf/ft_snprintf.c (renamed from src/io/ft_snprintf.c)0
-rw-r--r--src/io/ft_printf/ft_sprintf.c (renamed from src/io/ft_sprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vasprintf.c (renamed from src/io/ft_vasprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vdprintf.c (renamed from src/io/ft_vdprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vprintf.c (renamed from src/io/ft_vprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vsnprintf.c (renamed from src/io/ft_vsnprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vsprintf.c (renamed from src/io/ft_vsprintf.c)0
-rw-r--r--src/io/ft_printf/internals/convert.c (renamed from src/io/ft_printf/convert.c)0
-rw-r--r--src/io/ft_printf/internals/convert_char.c (renamed from src/io/ft_printf/convert_char.c)0
-rw-r--r--src/io/ft_printf/internals/convert_hex.c (renamed from src/io/ft_printf/convert_hex.c)0
-rw-r--r--src/io/ft_printf/internals/convert_int.c (renamed from src/io/ft_printf/convert_int.c)0
-rw-r--r--src/io/ft_printf/internals/convert_none.c (renamed from src/io/ft_printf/convert_none.c)0
-rw-r--r--src/io/ft_printf/internals/convert_percent.c (renamed from src/io/ft_printf/convert_percent.c)0
-rw-r--r--src/io/ft_printf/internals/convert_ptr.c (renamed from src/io/ft_printf/convert_ptr.c)0
-rw-r--r--src/io/ft_printf/internals/convert_str.c (renamed from src/io/ft_printf/convert_str.c)0
-rw-r--r--src/io/ft_printf/internals/convert_uint.c (renamed from src/io/ft_printf/convert_uint.c)0
-rw-r--r--src/io/ft_printf/internals/convert_written.c (renamed from src/io/ft_printf/convert_written.c)0
-rw-r--r--src/io/ft_printf/internals/extract.c (renamed from src/io/ft_printf/extract.c)0
-rw-r--r--src/io/ft_printf/internals/length_modifier.c (renamed from src/io/ft_printf/length_modifier.c)0
-rw-r--r--src/io/ft_printf/internals/list.c (renamed from src/io/ft_printf/list.c)0
-rw-r--r--src/io/ft_printf/internals/parse.c (renamed from src/io/ft_printf/parse.c)0
-rw-r--r--src/io/ft_printf/internals/utils.c (renamed from src/io/ft_printf/utils.c)0
-rw-r--r--src/lst/ft_lstreverse_ret.c3
-rw-r--r--src/mem/ft_memccpy.c12
-rw-r--r--src/mem/ft_memchr.c8
-rw-r--r--src/mem/ft_memcmp.c12
-rw-r--r--src/mem/ft_memcpy.c4
-rw-r--r--src/mem/ft_memmove.c4
-rw-r--r--src/mem/ft_memset.c4
-rw-r--r--src/str/ft_atoi_strict.c3
-rw-r--r--src/str/ft_strncpy.c4
-rw-r--r--src/str/ft_strtol.c4
37 files changed, 47 insertions, 141 deletions
diff --git a/src/io/get_next_line/get_next_line.c b/src/io/ft_get_next_line.c
index e51f152..4aecf3c 100644
--- a/src/io/get_next_line/get_next_line.c
+++ b/src/io/ft_get_next_line.c
@@ -6,13 +6,11 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/19 09:08:36 by cacharle #+# #+# */
-/* Updated: 2020/01/15 07:26:50 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:53:23 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include "get_next_line.h"
-
-#define HAS_NEWLINE(str, split_at) ((split_at = gnl_find_newline(str)) != -1)
+#include "libft.h"
static int gnl_find_newline(char *str)
{
@@ -46,12 +44,12 @@ static int gnl_read_line(int fd, char **line, char *rest)
int split_at;
char *buf;
- if ((buf = malloc(sizeof(char) * (BUFFER_SIZE + 1))) == NULL)
+ if ((buf = malloc(sizeof(char) * (GNL_BUFFER_SIZE + 1))) == NULL)
return (gnl_free_return(line, NULL, GNL_STATUS_ERROR));
- while ((ret = read(fd, buf, BUFFER_SIZE)) > 0)
+ while ((ret = read(fd, buf, GNL_BUFFER_SIZE)) > 0)
{
buf[ret] = '\0';
- if (HAS_NEWLINE(buf, split_at))
+ if ((split_at = gnl_find_newline(buf)) != -1)
{
ft_strcpy(rest, buf + split_at + 1);
buf[split_at] = '\0';
@@ -88,15 +86,15 @@ static int gnl_read_line(int fd, char **line, char *rest)
int get_next_line(int fd, char **line)
{
int split_at;
- static char rest[OPEN_MAX][BUFFER_SIZE + 1] = {{0}};
+ static char rest[OPEN_MAX][GNL_BUFFER_SIZE + 1] = {{0}};
- if (fd < 0 || fd > OPEN_MAX || line == NULL || BUFFER_SIZE <= 0)
+ if (fd < 0 || fd > OPEN_MAX || line == NULL || GNL_BUFFER_SIZE <= 0)
return (GNL_STATUS_ERROR);
if ((*line = ft_strdup("")) == NULL)
return (GNL_STATUS_ERROR);
if (rest[fd][0] == '\0')
return (gnl_read_line(fd, line, rest[fd]));
- if (HAS_NEWLINE(rest[fd], split_at))
+ if ((split_at = gnl_find_newline(rest[fd])) != -1)
{
free(*line);
if ((*line = (char*)malloc(sizeof(char) * (split_at + 1))) == NULL)
diff --git a/src/io/ft_printf.c b/src/io/ft_printf.c
deleted file mode 100644
index 1b92bb2..0000000
--- a/src/io/ft_printf.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* ft_printf.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/11/21 02:31:32 by cacharle #+# #+# */
-/* Updated: 2019/11/21 03:41:54 by cacharle ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "libft.h"
-
-int ft_printf(const char *format, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, format);
- ret = ft_vprintf(format, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/src/io/ft_asprintf.c b/src/io/ft_printf/ft_asprintf.c
index 5eb62d9..5eb62d9 100644
--- a/src/io/ft_asprintf.c
+++ b/src/io/ft_printf/ft_asprintf.c
diff --git a/src/io/ft_dprintf.c b/src/io/ft_printf/ft_dprintf.c
index 8e60970..8e60970 100644
--- a/src/io/ft_dprintf.c
+++ b/src/io/ft_printf/ft_dprintf.c
diff --git a/src/io/ft_printf/ft_printf.c b/src/io/ft_printf/ft_printf.c
index daa0cf2..1b92bb2 100644
--- a/src/io/ft_printf/ft_printf.c
+++ b/src/io/ft_printf/ft_printf.c
@@ -5,88 +5,20 @@
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/10/29 00:15:28 by cacharle #+# #+# */
-/* Updated: 2019/11/13 08:56:49 by cacharle ### ########.fr */
+/* Created: 2019/11/21 02:31:32 by cacharle #+# #+# */
+/* Updated: 2019/11/21 03:41:54 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include "ft_vasprintf.h"
+#include "libft.h"
-int ft_printf(const char *format, ...)
+int ft_printf(const char *format, ...)
{
- t_printf_status status;
+ int ret;
+ va_list ap;
- if (format == NULL)
- return (STATUS_ERROR);
- if (!parse(format, &status.flist))
- return (STATUS_ERROR);
- va_start(status.ap, format);
- status.format = format;
- status.out = NULL;
- status.out_size = 0;
- while (*status.format)
- {
- if (*status.format == '%'
- && (status.format =
- add_conversion(&status, status.flist->content)) == NULL)
- return (destroy_status_error(&status));
- else if ((status.format = add_between(&status)) == NULL)
- return (destroy_status_error(&status));
- }
- va_end(status.ap);
- list_destroy(&status.flist);
- write(STDOUT_FILENO, status.out, status.out_size);
- free(status.out);
- return (status.out_size);
-}
-
-const char *add_conversion(t_printf_status *status, t_pformat *pformat)
-{
- char *conversion_str;
-
- conversion_str = convert(pformat, status->ap);
- if (pformat->specifier == 'n')
- {
- if (pformat->written != NULL)
- *pformat->written = status->out_size;
- status->format += pformat->fmt_len;
- list_pop_front(&status->flist);
- return (status->format + 1);
- }
- if (conversion_str == NULL)
- return (NULL);
- if (pformat->specifier != 'c')
- pformat->size = ft_strlen(conversion_str);
- if ((status->out = ft_memjoin_free(status->out, status->out_size,
- conversion_str, pformat->size)) == NULL)
- return (NULL);
- status->out_size += pformat->size;
- free(conversion_str);
- status->format += pformat->fmt_len;
- list_pop_front(&status->flist);
- return (status->format + 1);
-}
-
-const char *add_between(t_printf_status *status)
-{
- int i;
-
- i = 0;
- while (status->format[i] && status->format[i] != '%')
- i++;
- if ((status->out = ft_memjoin_free(status->out, status->out_size,
- (void*)status->format, i)) == NULL)
- return (NULL);
- status->out_size += i;
- return (status->format + i);
-}
-
-int destroy_status_error(t_printf_status *status)
-{
- if (status == NULL)
- return (STATUS_ERROR);
- va_end(status->ap);
- list_destroy(&status->flist);
- free(status->out);
- return (STATUS_ERROR);
+ va_start(ap, format);
+ ret = ft_vprintf(format, ap);
+ va_end(ap);
+ return (ret);
}
diff --git a/src/io/ft_snprintf.c b/src/io/ft_printf/ft_snprintf.c
index e1fdfbd..e1fdfbd 100644
--- a/src/io/ft_snprintf.c
+++ b/src/io/ft_printf/ft_snprintf.c
diff --git a/src/io/ft_sprintf.c b/src/io/ft_printf/ft_sprintf.c
index 31da75e..31da75e 100644
--- a/src/io/ft_sprintf.c
+++ b/src/io/ft_printf/ft_sprintf.c
diff --git a/src/io/ft_vasprintf.c b/src/io/ft_printf/ft_vasprintf.c
index 85f66bc..85f66bc 100644
--- a/src/io/ft_vasprintf.c
+++ b/src/io/ft_printf/ft_vasprintf.c
diff --git a/src/io/ft_vdprintf.c b/src/io/ft_printf/ft_vdprintf.c
index a5e5ebf..a5e5ebf 100644
--- a/src/io/ft_vdprintf.c
+++ b/src/io/ft_printf/ft_vdprintf.c
diff --git a/src/io/ft_vprintf.c b/src/io/ft_printf/ft_vprintf.c
index b98670b..b98670b 100644
--- a/src/io/ft_vprintf.c
+++ b/src/io/ft_printf/ft_vprintf.c
diff --git a/src/io/ft_vsnprintf.c b/src/io/ft_printf/ft_vsnprintf.c
index 7db988c..7db988c 100644
--- a/src/io/ft_vsnprintf.c
+++ b/src/io/ft_printf/ft_vsnprintf.c
diff --git a/src/io/ft_vsprintf.c b/src/io/ft_printf/ft_vsprintf.c
index 91b4815..91b4815 100644
--- a/src/io/ft_vsprintf.c
+++ b/src/io/ft_printf/ft_vsprintf.c
diff --git a/src/io/ft_printf/convert.c b/src/io/ft_printf/internals/convert.c
index 398c754..398c754 100644
--- a/src/io/ft_printf/convert.c
+++ b/src/io/ft_printf/internals/convert.c
diff --git a/src/io/ft_printf/convert_char.c b/src/io/ft_printf/internals/convert_char.c
index c5f3a93..c5f3a93 100644
--- a/src/io/ft_printf/convert_char.c
+++ b/src/io/ft_printf/internals/convert_char.c
diff --git a/src/io/ft_printf/convert_hex.c b/src/io/ft_printf/internals/convert_hex.c
index 0464dc7..0464dc7 100644
--- a/src/io/ft_printf/convert_hex.c
+++ b/src/io/ft_printf/internals/convert_hex.c
diff --git a/src/io/ft_printf/convert_int.c b/src/io/ft_printf/internals/convert_int.c
index 2345f76..2345f76 100644
--- a/src/io/ft_printf/convert_int.c
+++ b/src/io/ft_printf/internals/convert_int.c
diff --git a/src/io/ft_printf/convert_none.c b/src/io/ft_printf/internals/convert_none.c
index 358ef1b..358ef1b 100644
--- a/src/io/ft_printf/convert_none.c
+++ b/src/io/ft_printf/internals/convert_none.c
diff --git a/src/io/ft_printf/convert_percent.c b/src/io/ft_printf/internals/convert_percent.c
index 813bb77..813bb77 100644
--- a/src/io/ft_printf/convert_percent.c
+++ b/src/io/ft_printf/internals/convert_percent.c
diff --git a/src/io/ft_printf/convert_ptr.c b/src/io/ft_printf/internals/convert_ptr.c
index 63babb9..63babb9 100644
--- a/src/io/ft_printf/convert_ptr.c
+++ b/src/io/ft_printf/internals/convert_ptr.c
diff --git a/src/io/ft_printf/convert_str.c b/src/io/ft_printf/internals/convert_str.c
index 7d51a5e..7d51a5e 100644
--- a/src/io/ft_printf/convert_str.c
+++ b/src/io/ft_printf/internals/convert_str.c
diff --git a/src/io/ft_printf/convert_uint.c b/src/io/ft_printf/internals/convert_uint.c
index 4207165..4207165 100644
--- a/src/io/ft_printf/convert_uint.c
+++ b/src/io/ft_printf/internals/convert_uint.c
diff --git a/src/io/ft_printf/convert_written.c b/src/io/ft_printf/internals/convert_written.c
index 4beeaef..4beeaef 100644
--- a/src/io/ft_printf/convert_written.c
+++ b/src/io/ft_printf/internals/convert_written.c
diff --git a/src/io/ft_printf/extract.c b/src/io/ft_printf/internals/extract.c
index c56a777..c56a777 100644
--- a/src/io/ft_printf/extract.c
+++ b/src/io/ft_printf/internals/extract.c
diff --git a/src/io/ft_printf/length_modifier.c b/src/io/ft_printf/internals/length_modifier.c
index 88226da..88226da 100644
--- a/src/io/ft_printf/length_modifier.c
+++ b/src/io/ft_printf/internals/length_modifier.c
diff --git a/src/io/ft_printf/list.c b/src/io/ft_printf/internals/list.c
index 99491f4..99491f4 100644
--- a/src/io/ft_printf/list.c
+++ b/src/io/ft_printf/internals/list.c
diff --git a/src/io/ft_printf/parse.c b/src/io/ft_printf/internals/parse.c
index 33928a0..33928a0 100644
--- a/src/io/ft_printf/parse.c
+++ b/src/io/ft_printf/internals/parse.c
diff --git a/src/io/ft_printf/utils.c b/src/io/ft_printf/internals/utils.c
index ad44980..ad44980 100644
--- a/src/io/ft_printf/utils.c
+++ b/src/io/ft_printf/internals/utils.c
diff --git a/src/lst/ft_lstreverse_ret.c b/src/lst/ft_lstreverse_ret.c
index 03ae98e..3e2118f 100644
--- a/src/lst/ft_lstreverse_ret.c
+++ b/src/lst/ft_lstreverse_ret.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 12:51:15 by cacharle #+# #+# */
-/* Updated: 2020/01/15 13:36:46 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:12:42 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,7 @@
t_list *ft_lstreverse_ret(t_list *lst)
{
t_list *tmp;
+
if (lst == NULL)
return (NULL);
if (lst->next == NULL)
diff --git a/src/mem/ft_memccpy.c b/src/mem/ft_memccpy.c
index f95aa03..8ce656a 100644
--- a/src/mem/ft_memccpy.c
+++ b/src/mem/ft_memccpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:01:53 by cacharle #+# #+# */
-/* Updated: 2019/11/20 03:30:45 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:03 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,12 +14,12 @@
void *ft_memccpy(void *dest, const void *src, int c, size_t n)
{
- size_t i;
- t_byte *cast_dest;
- t_byte *cast_src;
+ size_t i;
+ t_ftbyte *cast_dest;
+ t_ftbyte *cast_src;
- cast_dest = (t_byte*)dest;
- cast_src = (t_byte*)src;
+ cast_dest = (t_ftbyte*)dest;
+ cast_src = (t_ftbyte*)src;
i = -1;
while (++i < n)
{
diff --git a/src/mem/ft_memchr.c b/src/mem/ft_memchr.c
index d2364db..27e9028 100644
--- a/src/mem/ft_memchr.c
+++ b/src/mem/ft_memchr.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:55:31 by cacharle #+# #+# */
-/* Updated: 2019/11/20 03:30:55 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:53:57 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,10 +14,10 @@
void *ft_memchr(const void *s, int c, size_t n)
{
- size_t i;
- t_byte *cast_s;
+ size_t i;
+ t_ftbyte *cast_s;
- cast_s = (t_byte*)s;
+ cast_s = (t_ftbyte*)s;
i = -1;
while (++i < n)
if (cast_s[i] == (unsigned char)c)
diff --git a/src/mem/ft_memcmp.c b/src/mem/ft_memcmp.c
index 2c8e179..233d796 100644
--- a/src/mem/ft_memcmp.c
+++ b/src/mem/ft_memcmp.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:56:44 by cacharle #+# #+# */
-/* Updated: 2019/11/21 01:58:42 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:15 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,12 +14,12 @@
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
- size_t i;
- t_byte *cast_s1;
- t_byte *cast_s2;
+ size_t i;
+ t_ftbyte *cast_s1;
+ t_ftbyte *cast_s2;
- cast_s1 = (t_byte*)s1;
- cast_s2 = (t_byte*)s2;
+ cast_s1 = (t_ftbyte*)s1;
+ cast_s2 = (t_ftbyte*)s2;
if (n == 0)
return (0);
i = -1;
diff --git a/src/mem/ft_memcpy.c b/src/mem/ft_memcpy.c
index ca679fc..d0ef008 100644
--- a/src/mem/ft_memcpy.c
+++ b/src/mem/ft_memcpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:00:07 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:04:36 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:04 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,7 +22,7 @@ void *ft_memcpy(void *dest, const void *src, size_t n)
while (n % 8 > 0)
{
n--;
- ((t_byte*)dest)[n] = ((t_byte*)src)[n];
+ ((t_ftbyte*)dest)[n] = ((t_ftbyte*)src)[n];
}
long_dest = dest;
long_src = src;
diff --git a/src/mem/ft_memmove.c b/src/mem/ft_memmove.c
index 73e26b8..2f794fd 100644
--- a/src/mem/ft_memmove.c
+++ b/src/mem/ft_memmove.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:03:21 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:43:26 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:26 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,7 @@ void *ft_memmove(void *dst, const void *src, size_t len)
while (len % 8 > 0)
{
len--;
- *(t_byte*)dst++ = *(t_byte*)src++;
+ *(t_ftbyte*)dst++ = *(t_ftbyte*)src++;
}
long_dst = dst;
long_src = src;
diff --git a/src/mem/ft_memset.c b/src/mem/ft_memset.c
index 4ede5f3..89f53ff 100644
--- a/src/mem/ft_memset.c
+++ b/src/mem/ft_memset.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:01:23 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:40:59 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:10 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,7 @@ void *ft_memset(void *s, int c, size_t n)
c = (unsigned char)c;
while (n % 8 > 0)
- *((t_byte*)s + --n) = c;
+ *((t_ftbyte*)s + --n) = c;
buf = (long int)c | (long int)c << 8 | (long int)c << 16
| (long int)c << 24 | (long int)c << 32 | (long int)c << 40
| (long int)c << 48 | (long int)c << 56;
diff --git a/src/str/ft_atoi_strict.c b/src/str/ft_atoi_strict.c
index 6156b03..0079807 100644
--- a/src/str/ft_atoi_strict.c
+++ b/src/str/ft_atoi_strict.c
@@ -6,13 +6,12 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 10:06:29 by cacharle #+# #+# */
-/* Updated: 2020/01/15 14:09:03 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:12:54 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
-#include <stdio.h>
int ft_strict_atoi(const char *s)
{
char *end;
diff --git a/src/str/ft_strncpy.c b/src/str/ft_strncpy.c
index a0cfb4c..07a4927 100644
--- a/src/str/ft_strncpy.c
+++ b/src/str/ft_strncpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:26:59 by cacharle #+# #+# */
-/* Updated: 2019/11/21 02:49:48 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:40:21 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,7 +17,7 @@ char *ft_strncpy(char *dest, const char *src, size_t n)
size_t len;
len = ft_strlen(src);
- ft_memcpy(dest, src, MIN(n, len));
+ ft_memcpy(dest, src, n < len ? n : len);
if (len < n)
ft_bzero(dest + len, n - len);
return (dest);
diff --git a/src/str/ft_strtol.c b/src/str/ft_strtol.c
index 0fb5261..e5ce552 100644
--- a/src/str/ft_strtol.c
+++ b/src/str/ft_strtol.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 10:26:45 by cacharle #+# #+# */
-/* Updated: 2020/01/15 14:15:40 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:41 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -51,7 +51,7 @@ static long errno_return(int err)
long ft_strtol(const char *str, char **endptr, int base)
{
- t_bool is_negative;
+ t_ftbool is_negative;
long long nb;
char base_str[37];