update: Updated stuff so the scanner works great now
This commit is contained in:
parent
88c34b3904
commit
475038e2b7
21 changed files with 787 additions and 340 deletions
|
|
@ -65,11 +65,9 @@ t_error vec_ast_pop(t_vec_ast *vec, t_ast_node *value)
|
|||
t_ast_node temp_value;
|
||||
t_ast_node *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_ast_node *vec_ast_get(t_vec_ast *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_ast_node *vec_ast_last(t_vec_ast *vec)
|
||||
|
|
|
|||
|
|
@ -65,11 +65,9 @@ t_error vec_estr_pop(t_vec_estr *vec, t_expandable_str *value)
|
|||
t_expandable_str temp_value;
|
||||
t_expandable_str *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_expandable_str *vec_estr_get(t_vec_estr *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_expandable_str *vec_estr_last(t_vec_estr *vec)
|
||||
|
|
|
|||
|
|
@ -65,11 +65,9 @@ t_error vec_heredoc_pop(t_vec_heredoc *vec, t_heredoc *value)
|
|||
t_heredoc temp_value;
|
||||
t_heredoc *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_heredoc *vec_heredoc_get(t_vec_heredoc *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_heredoc *vec_heredoc_last(t_vec_heredoc *vec)
|
||||
|
|
|
|||
|
|
@ -65,11 +65,9 @@ t_error vec_pid_pop(t_vec_pid *vec, t_pid *value)
|
|||
t_pid temp_value;
|
||||
t_pid *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_pid *vec_pid_get(t_vec_pid *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_pid *vec_pid_last(t_vec_pid *vec)
|
||||
|
|
|
|||
|
|
@ -65,11 +65,9 @@ t_error vec_str_pop(t_vec_str *vec, t_str *value)
|
|||
t_str temp_value;
|
||||
t_str *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_str *vec_str_get(t_vec_str *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_str *vec_str_last(t_vec_str *vec)
|
||||
|
|
|
|||
|
|
@ -65,11 +65,9 @@ t_error vec_subtree_pop(t_vec_subtree *vec, t_subtree *value)
|
|||
t_subtree temp_value;
|
||||
t_subtree *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
if (vec == NULL || vec->len == 0)
|
||||
return (ERROR);
|
||||
ptr = value;
|
||||
if (vec->len == 0)
|
||||
return (ERROR);
|
||||
if (value == NULL)
|
||||
ptr = &temp_value;
|
||||
vec->len--;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
t_subtree *vec_subtree_get(t_vec_subtree *vec, t_usize i)
|
||||
{
|
||||
if (vec == NULL || vec->len >= i)
|
||||
if (vec == NULL || vec->buffer == NULL)
|
||||
return (NULL);
|
||||
return (&vec->buffer[i]);
|
||||
if (i < vec->len)
|
||||
return (&vec->buffer[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
t_subtree *vec_subtree_last(t_vec_subtree *vec)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue