Automatic add

This commit is contained in:
tosu 2023-03-30 23:43:29 +02:00
parent 940715a153
commit 68e07a4098
5 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ char *ft_strdup(char *src)
{ {
char *new_str; char *new_str;
new_str = malloc(8 * ft_strlen(src)); new_str = malloc(sizeof(char *) * ft_strlen(src));
ft_strcpy(new_str, src); ft_strcpy(new_str, src);
return (new_str); return (new_str);
} }

View File

@ -18,7 +18,7 @@ int *ft_range(int min, int max)
int idx; int idx;
if (min >= max) if (min >= max)
return ((void *) 0); return (NULL);
range = malloc(sizeof(int) * (max - min)); range = malloc(sizeof(int) * (max - min));
idx = -1; idx = -1;
while (++idx < max - min) while (++idx < max - min)

View File

@ -19,7 +19,7 @@ int ft_ultimate_range(int **range, int min, int max)
if (min >= max) if (min >= max)
{ {
*range = (void *) 0; *range = NULL;
return (-1); return (-1);
} }
*range = malloc(sizeof(int) * (max - min)); *range = malloc(sizeof(int) * (max - min));

View File

@ -77,7 +77,7 @@ int main(void)
size = 5; size = 5;
// sep = "<DELIM>"; // sep = "<DELIM>";
sep = ""; sep = "";
strs = malloc(sizeof((char *) 0) * size); strs = malloc(sizeof(char*) * size);
strs[0] = "First"; strs[0] = "First";
strs[1] = "Second"; strs[1] = "Second";
strs[2] = "Third"; strs[2] = "Third";

View File

@ -60,7 +60,7 @@ char *ft_to_base(int nbr, char *base_to)
base_len = is_valid_base(base_to, 1); base_len = is_valid_base(base_to, 1);
if (!base_len) if (!base_len)
return ((void *) 0); return (NULL);
result = malloc(sizeof(char) * MAX_OUTPUT_LEN); result = malloc(sizeof(char) * MAX_OUTPUT_LEN);
idx = -1; idx = -1;
while (++idx < MAX_OUTPUT_LEN) while (++idx < MAX_OUTPUT_LEN)