Add uc_str_append_all function
This commit is contained in:
@@ -105,3 +105,28 @@ void uc_strv_destroy(struct UCStrv *strv)
|
||||
strv->strings = NULL;
|
||||
}
|
||||
|
||||
int uc_strv_append_all(struct UCStrv *a, struct UCStrv *b, int copy)
|
||||
{
|
||||
size_t i;
|
||||
int rc;
|
||||
|
||||
rc = uc_strv_grow(a, a->allocated + b->cnt);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
for (i = 0; i < b->cnt; i++) {
|
||||
if (copy) {
|
||||
rc = uc_strv_append(a, b->strings[i]);
|
||||
} else {
|
||||
rc = uc_strv_append_nocopy(a, b->strings[i]);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user