mirror of
https://github.com/emqx/neuron.git
synced 2026-10-29 07:06:32 +08:00
array deep clone
This commit is contained in:
@@ -75,4 +75,15 @@ static inline void *utarray_steal(UT_array *array)
|
||||
for ((el) = (head); (el) != NULL; (el) = DECLTYPE(el)((el)->hh.next))
|
||||
#endif
|
||||
|
||||
static inline UT_array *utarray_deep_clone(UT_array *array)
|
||||
{
|
||||
UT_array *result = NULL;
|
||||
|
||||
utarray_new(result, &array->icd);
|
||||
|
||||
utarray_foreach(array, void *, elem) { utarray_push_back(result, elem); }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user