37 void *(*
copy)(
void *))
46 arr2 =
ft_calloc(len + 1,
sizeof(
void *));
48 return (
err(
"malloc()", 0));
55 arr2[i2] =
copy(arr[i - 1]);
56 if (arr[i - 1] && !arr2[i2++])
void ** arr_cut(void **arr, int len)
Create new null-terminated array containing first len elements of arr.
void ** arr_free(void **arr)
Free each element in a null-terminated array, and then the array itself.
int arr_has(void **arr, void *content, int(*compare)(void *, void *))
Check null-terminated array arr for entry content using comparison function compare.
int arr_len(void **arr)
Count number of elements in a null-terminated array.
void ** dedupe(void **arr, int(*compare)(void *, void *), void *(*copy)(void *))
Create new null-terminated array containing only unique values from arr, checked with compare,...
void * err(const char *str, void *retval)
Wrapper around perror() that always returns retval.
void * ft_calloc(size_t count, size_t size)
Allocates count * size bytes with malloc and returns a pointer to the result.
static void * copy(void *str)
Duplicate a path string and append a forward slash.
static int compare(void *a, void *b)
Compare path string a against path string b, which will always have a trailing forward slash.