leaks
This commit is contained in:
@@ -32,15 +32,15 @@ int add_node_back(t_node **head, char *val, t_token token, t_pres pres)
|
||||
{
|
||||
t_node *tmp;
|
||||
|
||||
tmp = *head;
|
||||
if (!val)
|
||||
return (0);
|
||||
if (!head || !(*head))
|
||||
{
|
||||
(*head) = create_node(val, token);
|
||||
*head = create_node(val, token);
|
||||
(*head)->pressision = pres;
|
||||
return (1);
|
||||
}
|
||||
tmp = *head;
|
||||
while (tmp->next != NULL)
|
||||
tmp = tmp->next;
|
||||
tmp->next = create_node(val, token);
|
||||
|
||||
@@ -26,7 +26,7 @@ static t_node *tokenize_base(char *str)
|
||||
while (tab[i])
|
||||
{
|
||||
if (!add_node_back(&head, tab[i], 0, 0))
|
||||
return (free(tab), NULL);
|
||||
return (free_tab(tab), NULL);
|
||||
i++;
|
||||
}
|
||||
free_tab(tab);
|
||||
@@ -116,12 +116,16 @@ t_node *tokenize(char *str)
|
||||
head = tokenize_base(str);
|
||||
if (!head)
|
||||
return (NULL);
|
||||
debug_token_list(head, "tokenizer");
|
||||
if (!trim_nodes(head))
|
||||
return (NULL);
|
||||
debug_token_list(head, "tokenizer");
|
||||
if (!unstick_nodes(head))
|
||||
return (NULL);
|
||||
debug_token_list(head, "tokenizer");
|
||||
stick_quote_node(head, 39);
|
||||
stick_quote_node(head, '"');
|
||||
debug_token_list(head, "tokenizer");
|
||||
set_token(head);
|
||||
del_void_nodes(&head);
|
||||
debug_token_list(head, "tokenizer");
|
||||
|
||||
Reference in New Issue
Block a user