Browse Source

[norm] minor fixes:
- spaces.
- variable not used: forbidden to remove it.
- double variable assignation.

- add todo.

Moul 4 years ago
parent
commit
86832ab06c
1 changed files with 60 additions and 58 deletions
  1. 60 58
      src/ft_itoa.c

+ 60 - 58
src/ft_itoa.c

@@ -6,7 +6,7 @@
 /*   By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2014/12/09 14:15:57 by mazimi            #+#    #+#             */
-/*   Updated: 2015/12/17 14:52:17 by mazimi           ###   ########.fr       */
+/*   Updated: 2016/09/26 14:18:43 by mazimi           ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -16,61 +16,63 @@ char	*ft_itoa(int c)
 {
 	return (ft_itoa_base(c, 10));
 }
-/*
-static char		*ft_turn(char *src, int lon)
-{
-	char	*dest;
-	int		i;
-	int		j;
-
-	dest = ft_strnew(lon);
-	j = lon;
-	i = -1;
-	while (++i < lon)
-		dest[i] = src[--j];
-	return (dest);
-}
-
-static int		intlen(int c)
-{
-	int		i;
-	int		lon;
 
-	i = 1;
-	if (c < 0)
-		i++;
-	lon = c;
-	while (lon >= 10 || lon <= -10)
-	{
-		lon = lon / 10;
-		i++;
-	}
-	return (i);
-}
-
-char			*ft_itoa(int c)
-{
-	int		lon;
-	char	*str;
-	char	*dst;
-	int		cc;
-	int		i;
-
-	if (c == -2147483648)
-		return (ft_strdup("-2147483648"));
-	cc = c;
-	lon = intlen(c);
-	str = ft_strnew(lon);
-	if (c < 0)
-		c = -c;
-	i = -1;
-	while (++i < lon)
-	{
-		str[i] = (c % 10) + 48;
-		c = c / 10;
-	}
-	if (cc < 0)
-		str[i - 1] = '-';
-	dst = ft_turn(str, lon);
-	return (dst);
-}*/
+/*
+**static char		*ft_turn(char *src, int lon)
+**{
+**	char	*dest;
+**	int		i;
+**	int		j;
+**
+**	dest = ft_strnew(lon);
+**	j = lon;
+**	i = -1;
+**	while (++i < lon)
+**		dest[i] = src[--j];
+**	return (dest);
+**}
+**
+**static int		intlen(int c)
+**{
+**	int		i;
+**	int		lon;
+**
+**	i = 1;
+**	if (c < 0)
+**		i++;
+**	lon = c;
+**	while (lon >= 10 || lon <= -10)
+**	{
+**		lon = lon / 10;
+**		i++;
+**	}
+**	return (i);
+**}
+**
+**char			*ft_itoa(int c)
+**{
+**	int		lon;
+**	char	*str;
+**	char	*dst;
+**	int		cc;
+**	int		i;
+**
+**	if (c == -2147483648)
+**		return (ft_strdup("-2147483648"));
+**	cc = c;
+**	lon = intlen(c);
+**	str = ft_strnew(lon);
+**	if (c < 0)
+**		c = -c;
+**	i = -1;
+**	while (++i < lon)
+**	{
+**		str[i] = (c % 10) + 48;
+**		c = c / 10;
+**	}
+**	if (cc < 0)
+**		str[i - 1] = '-';
+**	dst = ft_turn(str, lon);
+**	return (dst);
+**}
+*/