1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| void ordon_data(t_data **list, t_args *ptr)
{
t_data *moove;
t_data *new;
ptr->fin = 0;
ptr->debut = 0;
moove = malloc(sizeof(*moove)); /*Est il utile malloc moove ? Quand ma liste est complete, je l'envoie plus loin dans le main, puis l'execute, puis la free, et le main reprends au debut, esceque je dois free moove a part ou son espace memoire est il le meme que la liste ?*/
while (ptr->fin < ptr->len)
{
new = malloc(sizeof(*new)); /*Faut il vraiment malloc a chaque fois sans free ?*/
new->next = NULL;
if (ptr->args[ptr->fin])
find_the_next_cmd(&(ptr->fin), ptr->args);
list_malloc_args_tab(&new, ptr->args, ptr->debut, ptr->fin);
list_full_args_tab(&new, ptr->args, &(ptr->debut), ptr->fin);
if (ptr->args[ptr->fin])
ptr->fin++;
if (*list == NULL)
*list = new;
else if (*list != NULL)
{
moove = *list;
while (moove->next != NULL)
moove = moove->next;
moove->next = new;
}
}
} |
Partager