forked from 42-shell/minishell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_vector.h
41 lines (34 loc) · 1.47 KB
/
string_vector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* string_vector.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jkong <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/21 15:37:17 by jkong #+# #+# */
/* Updated: 2022/06/23 17:36:44 by jkong ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef STRING_VECTOR_H
# define STRING_VECTOR_H
# include "safe_mem.h"
# include <stdlib.h>
# ifndef INITIAL_CAPACITY_V
# define INITIAL_CAPACITY_V 0x4
# endif
# ifndef GROW_THRESHOLD_V
# define GROW_THRESHOLD_V 0x20
# endif
typedef struct s_str_vec
{
char **arr;
size_t length;
size_t capacity;
} t_str_vec;
t_str_vec *strv_append(t_str_vec *vec, char *s);
t_str_vec *strv_append_bulk(t_str_vec *vec, char **arr);
char **strv_dispose(t_str_vec *vec);
size_t length_strvec(char **arr);
void sort_strvec(char **arr, int (*cmp)(const char *, const char *));
void free_strvec(char **arr);
#endif