From efac395168145959479f451ad3484f1174d4accb Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 19 Sep 2024 15:36:59 +0200 Subject: [PATCH] style: noming ast_function(3/4).c --- output/src/vec/ast/ast_functions3.c | 25 +++++++++--------- output/src/vec/ast/ast_functions4.c | 39 ++++++++++++++--------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/output/src/vec/ast/ast_functions3.c b/output/src/vec/ast/ast_functions3.c index 78e586ae..31b482cd 100644 --- a/output/src/vec/ast/ast_functions3.c +++ b/output/src/vec/ast/ast_functions3.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* vec_ast.c :+: :+: :+: */ +/* ast_functions3.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/30 17:59:28 by maiboyer #+# #+# */ -/* Updated: 2023/12/30 17:59:28 by maiboyer ### ########.fr */ +/* Updated: 2024/09/19 15:34:10 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,15 +15,14 @@ #include "me/vec/vec_ast.h" #include -t_error vec_ast_push_front(t_vec_ast *vec, - t_ast_node element) +t_error vec_ast_push_front(t_vec_ast *vec, t_ast_node element) { - t_usize i; + t_usize i; if (vec->len == 0) return (vec_ast_push(vec, element)); i = vec->len - 1; - if (vec->capacity < vec->len + 1 && + if (vec->capacity < vec->len + 1 && \ vec_ast_reserve(vec, 3 * vec->len / 2 + 1)) return (ERROR); while (i > 0) @@ -37,9 +36,9 @@ t_error vec_ast_push_front(t_vec_ast *vec, return (NO_ERROR); } -t_error vec_ast_pop_front(t_vec_ast *vec, t_ast_node *value) +t_error vec_ast_pop_front(t_vec_ast *vec, t_ast_node *value) { - t_usize i; + t_usize i; if (vec->len <= 1) return (vec_ast_pop(vec, value)); @@ -55,10 +54,10 @@ t_error vec_ast_pop_front(t_vec_ast *vec, t_ast_node *value) return (NO_ERROR); } -void vec_ast_reverse(t_vec_ast *vec) +void vec_ast_reverse(t_vec_ast *vec) { - t_ast_node temporary; - t_usize i; + t_ast_node temporary; + t_usize i; i = 0; while (i < vec->len / 2) @@ -70,9 +69,9 @@ void vec_ast_reverse(t_vec_ast *vec) } } -t_error vec_ast_back(t_vec_ast *vec, t_ast_node **out) +t_error vec_ast_back(t_vec_ast *vec, t_ast_node **out) { - t_ast_node *temporary; + t_ast_node *temporary; if (out == NULL) out = &temporary; diff --git a/output/src/vec/ast/ast_functions4.c b/output/src/vec/ast/ast_functions4.c index b548a698..a91175dd 100644 --- a/output/src/vec/ast/ast_functions4.c +++ b/output/src/vec/ast/ast_functions4.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* vec_ast.c :+: :+: :+: */ +/* ast_functions4.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/30 17:59:28 by maiboyer #+# #+# */ -/* Updated: 2023/12/30 17:59:28 by maiboyer ### ########.fr */ +/* Updated: 2024/09/19 15:36:47 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,7 @@ #include "me/vec/vec_ast.h" #include -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->buffer == NULL) return (NULL); @@ -24,14 +24,14 @@ t_ast_node *vec_ast_get(t_vec_ast *vec, t_usize i) return (NULL); } -t_ast_node *vec_ast_last(t_vec_ast *vec) +t_ast_node *vec_ast_last(t_vec_ast *vec) { if (vec == NULL || vec->len == 0) return (NULL); return (&vec->buffer[vec->len - 1]); } -void vec_ast_copy_into(t_vec_ast *vec, t_vec_ast *dest) +void vec_ast_copy_into(t_vec_ast *vec, t_vec_ast *dest) { if (vec == NULL || dest == NULL) return ; @@ -39,21 +39,20 @@ void vec_ast_copy_into(t_vec_ast *vec, t_vec_ast *dest) mem_copy(dest->buffer, vec->buffer, vec->len * sizeof(t_ast_node)); } -struct s_vec_ast_splice_arguments vec_ast_splice_args( +struct s_vec_ast_splice_arguments vec_ast_splice_args( t_usize index, t_usize old_count, t_usize new_count, const t_ast_node *elements) { - return ((struct s_vec_ast_splice_arguments){index, old_count, - new_count, elements}); + return ((struct s_vec_ast_splice_arguments){index, old_count, \ + new_count, elements}); } -void vec_ast_splice(t_vec_ast *self, - struct s_vec_ast_splice_arguments args) +void vec_ast_splice(t_vec_ast *self, struct s_vec_ast_splice_arguments args) { - t_ast_node *contents; - t_u32 new_size; - t_u32 old_end; - t_u32 new_end; + t_ast_node *contents; + t_u32 new_size; + t_u32 old_end; + t_u32 new_end; new_size = self->len + args.new_count - args.old_count; old_end = args.index + args.old_count; @@ -61,17 +60,17 @@ void vec_ast_splice(t_vec_ast *self, vec_ast_reserve(self, new_size); contents = self->buffer; if (self->len > old_end) - mem_move(contents + new_end, - contents + old_end, - (self->len - old_end) * sizeof(t_ast_node)); + mem_move(contents + new_end, \ + contents + old_end, \ + (self->len - old_end) * sizeof(t_ast_node)); if (args.new_count > 0) { if (args.elements) - mem_copy((contents + args.index * sizeof(t_ast_node)), - args.elements, args.new_count * sizeof(t_ast_node)); + mem_copy((contents + args.index * sizeof(t_ast_node)), \ + args.elements, args.new_count * sizeof(t_ast_node)); else mem_set_zero((contents + args.index * sizeof(t_ast_node)), - args.new_count * sizeof(t_ast_node)); + args.new_count * sizeof(t_ast_node)); } self->len += args.new_count - args.old_count; }