garray: Add g_ptr_array_new_take() to take a C array without copies

GPtrArray is a nice interface to handle pointer arrays, however if a classic
array needs to be converted into a GPtrArray is currently needed to manually
go through all its elements and do new allocations that could be avoided.

So add g_ptr_array_new_take() which steals the data from an array of
pointers and allows to manage it using the GPtrArray API.
This commit is contained in:
Marco Trevisan (Treviño)
2022-12-07 13:35:04 +01:00
parent 4eb9b09014
commit 14ded2ef94
4 changed files with 197 additions and 0 deletions

View File

@@ -2715,6 +2715,7 @@ g_ptr_array_new_with_free_func
g_ptr_array_copy
g_ptr_array_new_full
g_ptr_array_new_null_terminated
g_ptr_array_new_take
g_ptr_array_set_free_func
g_ptr_array_is_null_terminated
g_ptr_array_ref