summaryrefslogtreecommitdiffstats
path: root/libft/src/ft_itoa.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libft/src/ft_itoa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libft/src/ft_itoa.c b/libft/src/ft_itoa.c
index 255d0a8..2c0c14e 100644
--- a/libft/src/ft_itoa.c
+++ b/libft/src/ft_itoa.c
@@ -21,10 +21,12 @@ char *ft_itoa(long n)
uint8_t i;
i = ft_intlen(n) - 1;
- if (!(s = (char*)malloc((i + 2) * sizeof(char))))
+ if ((s = (char*)malloc((i + 2) * sizeof(char))) == NULL)
return (NULL);
- if (!n)
+ if (n == 0)
+ {
s[i] = '0';
+ }
nb = n;
if (n < 0)
{