change the name of functions in convertbaseFree to distinguish them from convertbase

This commit is contained in:
Hugo LAMY
2020-02-27 20:27:43 +01:00
parent 387758be4d
commit cb9818bc55

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/26 20:19:54 by hulamy #+# #+# */
/* Updated: 2020/02/26 20:20:14 by hulamy ### ########.fr */
/* Updated: 2020/02/27 20:23:22 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -47,7 +47,7 @@
*/
int
is_valid_base(char *base)
is_base_valid(char *base)
{
int i;
int j;
@@ -76,13 +76,13 @@ int
*/
int
is_valid_nbr(char *nbr, char *base)
is_nbr_valid(char *nbr, char *base)
{
int i;
int j;
i = 0;
if (!is_valid_base(base))
if (!is_base_valid(base))
return (0);
while (nbr[i])
{
@@ -107,7 +107,7 @@ int
*/
unsigned long int
base_to_decimal(char *nbr, char *base, int *error)
base_2_decimal(char *nbr, char *base, int *error)
{
unsigned long int decimal;
int i;
@@ -140,7 +140,7 @@ unsigned long int
*/
char
*decimal_to_base(unsigned long int decimal, char *base, int malloc_size)
*decimal_2_base(unsigned long int decimal, char *base, int malloc_size)
{
int base_size;
int neg;
@@ -188,11 +188,11 @@ char
nbr++;
length = 1;
}
if (!is_valid_nbr(nbr, base_from) || !is_valid_base(base_to))
if (!is_nbr_valid(nbr, base_from) || !is_base_valid(base_to))
return (NULL);
decimal = base_to_decimal(nbr, base_from, &error);
decimal = base_2_decimal(nbr, base_from, &error);
if (error == 1)
return (NULL);
free(nbr);
return (decimal_to_base(decimal, base_to, length));
return (decimal_2_base(decimal, base_to, length));
}