update: Updated stuff so the scanner works great now

This commit is contained in:
Maieul BOYER 2024-09-06 16:46:01 +02:00
parent 88c34b3904
commit 475038e2b7
No known key found for this signature in database
21 changed files with 787 additions and 340 deletions

View file

@ -9,11 +9,11 @@ me_alloc/merge_blocks \
me_alloc/pages \ me_alloc/pages \
me_alloc/realloc \ me_alloc/realloc \
vg/dummy_block \ vg/dummy_block \
vg/dummy_mem_status \
vg/dummy_mempool \ vg/dummy_mempool \
vg/dummy_mempool_bis \ vg/dummy_mempool_bis \
vg/dummy_mem_status \
vg/valgrind_block \ vg/valgrind_block \
vg/valgrind_mem_status \
vg/valgrind_mempool \ vg/valgrind_mempool \
vg/valgrind_mempool_bis \ vg/valgrind_mempool_bis \
vg/valgrind_mem_status \

View file

@ -1,4 +1,8 @@
SRC_FILES = \ SRC_FILES = \
_here_doc \
_not_done_boucle_print \
_not_done_function \
_not_done_scripting_print \
ast_alloc/ast_alloc \ ast_alloc/ast_alloc \
ast_alloc/ast_alloc_scripting \ ast_alloc/ast_alloc_scripting \
ast_free/ast_free \ ast_free/ast_free \
@ -17,10 +21,6 @@ from_node/node_utils2 \
from_node/redirect_node \ from_node/redirect_node \
from_node/scripting_node \ from_node/scripting_node \
from_node/string_node \ from_node/string_node \
_here_doc \
_not_done_boucle_print \
_not_done_function \
_not_done_scripting_print \
print_ast/ast_print \ print_ast/ast_print \
print_ast/ast_print_arithmetic \ print_ast/ast_print_arithmetic \
print_ast/ast_print_command \ print_ast/ast_print_command \

View file

@ -1,17 +1,17 @@
SRC_FILES = \ SRC_FILES = \
builtins/cd \
builtins/_debug \ builtins/_debug \
builtins/cd \
builtins/echo \ builtins/echo \
builtins/env \ builtins/env \
builtins/exit \ builtins/exit \
builtins/export \ builtins/export \
builtins/pwd \ builtins/pwd \
builtins/unset \ builtins/unset \
run_arithmetic/arithmetic \
run_arithmetic/arithmetic_operation \
run_arithmetic/_get_op \ run_arithmetic/_get_op \
run_arithmetic/operator_bis \
run_arithmetic/_run_arith \ run_arithmetic/_run_arith \
run_arithmetic/_to_ast_node \ run_arithmetic/_to_ast_node \
run_arithmetic/arithmetic \
run_arithmetic/arithmetic_operation \
run_arithmetic/operator_bis \
run_ast \ run_ast \

View file

@ -2,11 +2,11 @@ SRC_FILES = \
line \ line \
line_edit_actions \ line_edit_actions \
line_edit_actions2 \ line_edit_actions2 \
line_editing \
line_editing2 \
line_edit_mode \ line_edit_mode \
line_edit_mode_interal \ line_edit_mode_interal \
line_edit_mode_specific_key \ line_edit_mode_specific_key \
line_editing \
line_editing2 \
line_globals \ line_globals \
line_history \ line_history \
line_internals \ line_internals \

View file

@ -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 temp_value;
t_ast_node *ptr; t_ast_node *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_ast_node *vec_ast_get(t_vec_ast *vec, t_usize i) 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 (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) t_ast_node *vec_ast_last(t_vec_ast *vec)

View file

@ -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 temp_value;
t_expandable_str *ptr; t_expandable_str *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_expandable_str *vec_estr_get(t_vec_estr *vec, t_usize i) 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 (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) t_expandable_str *vec_estr_last(t_vec_estr *vec)

View file

@ -65,11 +65,9 @@ t_error vec_heredoc_pop(t_vec_heredoc *vec, t_heredoc *value)
t_heredoc temp_value; t_heredoc temp_value;
t_heredoc *ptr; t_heredoc *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_heredoc *vec_heredoc_get(t_vec_heredoc *vec, t_usize i) 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 (NULL);
return (&vec->buffer[i]); if (i < vec->len)
return (&vec->buffer[i]);
return (NULL);
} }
t_heredoc *vec_heredoc_last(t_vec_heredoc *vec) t_heredoc *vec_heredoc_last(t_vec_heredoc *vec)

View file

@ -65,11 +65,9 @@ t_error vec_pid_pop(t_vec_pid *vec, t_pid *value)
t_pid temp_value; t_pid temp_value;
t_pid *ptr; t_pid *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_pid *vec_pid_get(t_vec_pid *vec, t_usize i) 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 (NULL);
return (&vec->buffer[i]); if (i < vec->len)
return (&vec->buffer[i]);
return (NULL);
} }
t_pid *vec_pid_last(t_vec_pid *vec) t_pid *vec_pid_last(t_vec_pid *vec)

View file

@ -65,11 +65,9 @@ t_error vec_str_pop(t_vec_str *vec, t_str *value)
t_str temp_value; t_str temp_value;
t_str *ptr; t_str *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_str *vec_str_get(t_vec_str *vec, t_usize i) 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 (NULL);
return (&vec->buffer[i]); if (i < vec->len)
return (&vec->buffer[i]);
return (NULL);
} }
t_str *vec_str_last(t_vec_str *vec) t_str *vec_str_last(t_vec_str *vec)

View file

@ -65,11 +65,9 @@ t_error vec_subtree_pop(t_vec_subtree *vec, t_subtree *value)
t_subtree temp_value; t_subtree temp_value;
t_subtree *ptr; t_subtree *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
t_subtree *vec_subtree_get(t_vec_subtree *vec, t_usize i) 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 (NULL);
return (&vec->buffer[i]); if (i < vec->len)
return (&vec->buffer[i]);
return (NULL);
} }
t_subtree *vec_subtree_last(t_vec_subtree *vec) t_subtree *vec_subtree_last(t_vec_subtree *vec)

File diff suppressed because it is too large Load diff

View file

@ -35,10 +35,10 @@ fs/fs_internal \
fs/getters \ fs/getters \
fs/putfd \ fs/putfd \
gnl/get_next_line \ gnl/get_next_line \
hash/hasher \
hash/hash_signed \ hash/hash_signed \
hash/hash_str \ hash/hash_str \
hash/hash_unsigned \ hash/hash_unsigned \
hash/hasher \
hash/sip/sip13 \ hash/sip/sip13 \
hash/sip/sip_utils \ hash/sip/sip_utils \
hash/sip/sip_utils2 \ hash/sip/sip_utils2 \
@ -86,10 +86,6 @@ printf/printf \
printf/printf_fd \ printf/printf_fd \
printf/printf_str \ printf/printf_str \
printf/vprintf \ printf/vprintf \
string/mod \
string/string_insert \
string/string_remove \
string/string_reserve \
str/str_clone \ str/str_clone \
str/str_compare \ str/str_compare \
str/str_find_chr \ str/str_find_chr \
@ -106,6 +102,10 @@ str/str_n_find_str \
str/str_split \ str/str_split \
str/str_substring \ str/str_substring \
str/str_trim \ str/str_trim \
string/mod \
string/string_insert \
string/string_remove \
string/string_reserve \
GEN_FILES = \ GEN_FILES = \
convert/i16_to_str \ convert/i16_to_str \

View file

@ -65,11 +65,9 @@ t_error vec_C__PREFIX___pop(t_vec_C__PREFIX__ *vec, C__TYPENAME__ *value)
C__TYPENAME__ temp_value; C__TYPENAME__ temp_value;
C__TYPENAME__ *ptr; C__TYPENAME__ *ptr;
if (vec == NULL) if (vec == NULL || vec->len == 0)
return (ERROR); return (ERROR);
ptr = value; ptr = value;
if (vec->len == 0)
return (ERROR);
if (value == NULL) if (value == NULL)
ptr = &temp_value; ptr = &temp_value;
vec->len--; vec->len--;

View file

@ -17,9 +17,11 @@
C__TYPENAME__ *vec_C__PREFIX___get(t_vec_C__PREFIX__ *vec, t_usize i) C__TYPENAME__ *vec_C__PREFIX___get(t_vec_C__PREFIX__ *vec, t_usize i)
{ {
if (vec == NULL || vec->len >= i) if (vec == NULL || vec->buffer == NULL)
return (NULL); return (NULL);
return (&vec->buffer[i]); if (i < vec->len)
return (&vec->buffer[i]);
return (NULL);
} }
C__TYPENAME__ *vec_C__PREFIX___last(t_vec_C__PREFIX__ *vec) C__TYPENAME__ *vec_C__PREFIX___last(t_vec_C__PREFIX__ *vec)

View file

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
make && valgrind --leak-check=full --show-leak-kinds=none --track-origins=yes --track-fds=yes --trace-children=yes --read-var-info=yes --read-inline-info=yes ./minishell <<<'cat <<EOF make && valgrind --leak-check=full --show-leak-kinds=none --track-origins=yes --track-fds=yes --trace-children=yes --read-var-info=yes --read-inline-info=yes ./minishell <<<'cat <<EOF | xargs printf "\x1b[32m%s \x1b[0m\n"
bonjour je suis un heredoc bonjour je suis un heredoc
le saviez tu je dois finir par EOF mais qui est sur la ligne le saviez tu je dois finir par EOF mais qui est sur la ligne
donc par example si j ai cette ligne qui fini avec EOF donc par example si j ai cette ligne qui fini avec EOF
rien ne se passe rien ne se passe
mais la ligne d en dessous fini le heredoc :D mais la ligne d en dessous fini le heredoc :D
EOF' EOF'