libobs: Add obs_data_array_push_back_array
Allows easily/safely appending all the values of one data array to another.
This commit is contained in:
parent
a8517f3698
commit
2329c6f6ea
@ -1319,6 +1319,19 @@ void obs_data_array_insert(obs_data_array_t *array, size_t idx, obs_data_t *obj)
|
||||
da_insert(array->objects, idx, &obj);
|
||||
}
|
||||
|
||||
void obs_data_array_push_back_array(obs_data_array_t *array,
|
||||
obs_data_array_t *array2)
|
||||
{
|
||||
if (!array || !array2)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < array2->objects.num; i++) {
|
||||
obs_data_t *obj = array2->objects.array[i];
|
||||
obs_data_addref(obj);
|
||||
}
|
||||
da_push_back_da(array->objects, array2->objects);
|
||||
}
|
||||
|
||||
void obs_data_array_erase(obs_data_array_t *array, size_t idx)
|
||||
{
|
||||
if (array) {
|
||||
|
@ -159,6 +159,8 @@ EXPORT obs_data_t *obs_data_array_item(obs_data_array_t *array, size_t idx);
|
||||
EXPORT size_t obs_data_array_push_back(obs_data_array_t *array, obs_data_t *obj);
|
||||
EXPORT void obs_data_array_insert(obs_data_array_t *array, size_t idx,
|
||||
obs_data_t *obj);
|
||||
EXPORT void obs_data_array_push_back_array(obs_data_array_t *array,
|
||||
obs_data_array_t *array2);
|
||||
EXPORT void obs_data_array_erase(obs_data_array_t *array, size_t idx);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user