diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-22 16:06:31 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-22 16:06:31 -0500 |
commit | 968bbd92cf9bf9cc364baa973d81f4dcfa647ca3 (patch) | |
tree | c0c41aff106ae0543cfc91ab7ab08825863b4406 /arr.c | |
parent | 2b24b61b156a66dd518f739156c424dbede075b9 (diff) |
show working directory in file selector
Diffstat (limited to 'arr.c')
-rw-r--r-- | arr.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -208,18 +208,18 @@ static inline void arr_set_len_(void **arr, size_t member_size, size_t n) { } while (0) -static void arr_append_str_(char **a, char const *s) { +static void arr_append_strn_(char **a, char const *s, size_t s_len) { size_t curr_len = arr_len(*a); - size_t s_len = strlen(s); - if (curr_len) --curr_len; // don't include null terminator arr_set_len(*a, curr_len + s_len + 1); memcpy(*a + curr_len, s, s_len + 1); } -// appends a C-string array with -#define arr_append_str(a, s) arr_append_str_(&(a), (s)) +// append to a C-string array +#define arr_append_str(a, s) arr_append_strn_(&(a), (s), strlen(s)) +// take at most n bytes from s +#define arr_append_strn(a, s, n) arr_append_strn_(&(a), (s), (n)) static void arr_test(void) { u32 *arr = NULL; |