minishell
vect_push_back.c
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* vect_push_back.c :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: kfujita <kfujita@student.42tokyo.jp> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2023/01/28 00:30:13 by kfujita #+# #+# */
9 /* Updated: 2023/02/06 23:58:04 by kfujita ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
13 #include "ft_vect.h"
14 
15 bool vect_push_back(t_vect *vect, const void *elem, size_t *written_index)
16 {
17  size_t index;
18 
19  index = vect->len;
20  if (!vect_set(vect, elem, index))
21  return (false);
22  if (written_index != NULL)
23  *written_index = index;
24  return (true);
25 }
bool vect_set(t_vect *vect, const void *elem, size_t index)
Definition: vect_set.c:16
Definition: ft_vect.h:24
size_t len
Definition: ft_vect.h:26
bool vect_push_back(t_vect *vect, const void *elem, size_t *written_index)