diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-08 12:06:45 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-08-08 12:22:54 -0400 |
commit | a081a841ed38b60e8fd9e41c2499188826945e1f (patch) | |
tree | cb6ce96cb4cb3174666dfe8860432ef4df695665 | |
parent | 1c65b4c4a73292892c5017e9977c5bb184e892c2 (diff) | |
download | stasis-a081a841ed38b60e8fd9e41c2499188826945e1f.tar.gz |
Fix strlist_append_tokenize
* original pointer is no longer modified
* token strings are stripped of leading space before appending to the list
-rw-r--r-- | src/strlist.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/strlist.c b/src/strlist.c index bdacb5a..d1bb926 100644 --- a/src/strlist.c +++ b/src/strlist.c @@ -174,13 +174,16 @@ void strlist_append_strlist(struct StrList *pStrList1, struct StrList *pStrList2 return; } - token = split(str, delim, 0); + char *tmp = strdup(str); + token = split(tmp, delim, 0); if (token) { for (size_t i = 0; token[i] != NULL; i++) { + lstrip(token[i]); strlist_append(&pStrList, token[i]); } GENERIC_ARRAY_FREE(token); } + guard_free(tmp); } /** |