mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
astobj2: Create function to copy weak proxied objects from container.
Create ao2_container_dup_weakproxy_objs to perform a similar function to ao2_container_dup. This function expects the source container to have weakproxy objects, inserts the associated non-weak objects into the destination container. Orphaned weakproxy objects are ignored. Create test for this new function and for ao2_weakproxy_find. Change-Id: I898387f058057e08696fe9070f8cd94ef3a27482
This commit is contained in:
@@ -1433,6 +1433,28 @@ int ao2_container_count(struct ao2_container *c);
|
||||
*/
|
||||
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags);
|
||||
|
||||
/*!
|
||||
* \brief Copy object references associated with src container weakproxies into the dest container.
|
||||
*
|
||||
* \param dest Container to copy src strong object references into.
|
||||
* \param src Container to copy all weak object references from.
|
||||
* \param flags OBJ_NOLOCK if a lock is already held on both containers.
|
||||
* Otherwise, the src container is locked first.
|
||||
*
|
||||
* \pre The dest container must be empty. If the duplication fails, the
|
||||
* dest container will be returned empty.
|
||||
*
|
||||
* \note This can potentially be expensive because a malloc is
|
||||
* needed for every object in the src container.
|
||||
*
|
||||
* \note Every object inside the container is locked by \ref ao2_weakproxy_get_object.
|
||||
* Any weakproxy in \ref src with no associated object is ignored.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int ao2_container_dup_weakproxy_objs(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags);
|
||||
|
||||
/*!
|
||||
* \brief Create a clone/copy of the given container.
|
||||
* \since 11.0
|
||||
|
Reference in New Issue
Block a user