pff
This commit is contained in:
@@ -28,14 +28,21 @@ t_node *create_node(char *val, t_token token)
|
||||
return (node);
|
||||
}
|
||||
|
||||
int add_node_back(t_node *head, char *val, t_token token)
|
||||
int add_node_back(t_node **head, char *val, t_token token, t_pres pres)
|
||||
{
|
||||
if (!val)
|
||||
return (0);
|
||||
while (head->next != NULL)
|
||||
head = head->next;
|
||||
head->next = create_node(val, token);
|
||||
if (head->next == NULL)
|
||||
if (!(*head))
|
||||
{
|
||||
(*head) = create_node(val, token);
|
||||
(*head)->pressision = pres;
|
||||
return (1);
|
||||
}
|
||||
while ((*head)->next != NULL)
|
||||
(*head) = (*head)->next;
|
||||
(*head)->next = create_node(val, token);
|
||||
(*head)->next->pressision = pres;
|
||||
if ((*head)->next == NULL)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static t_node *tokenize_base(char *str)
|
||||
i = 1;
|
||||
while (tab[i])
|
||||
{
|
||||
if (!add_node_back(head, tab[i], 0))
|
||||
if (!add_node_back(&head, tab[i], 0, 0))
|
||||
return (free(tab), NULL);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef struct s_node
|
||||
|
||||
t_node *tokenize(char *str);
|
||||
t_node *create_node(char *val, t_token token);
|
||||
int add_node_back(t_node *head, char *val, t_token token);
|
||||
int add_node_back(t_node **head, char *val, t_token token, t_pres pres);
|
||||
int merge_with_next_node(t_node *node);
|
||||
void free_linked_list(t_node *stack);
|
||||
t_token get_token(char *str);
|
||||
|
||||
Reference in New Issue
Block a user