prg_list_transfer()
Abstract
Copies the contents of a source list into a destination list (source elements allocated by non-Riverbed APIs).
Syntax
prg_list_transfer (from_list_ptr, to_list_ptr, elem_size)
| Argument | Type | Description |
|---|---|---|
from_list_ptr |
PrgT_List * |
Pointer to the list to copy from. |
to_list_ptr |
PrgT_List * |
Pointer to the list to copy to. |
elem_size |
size_t |
Size of elements to copy. |
Return Type
void
No return value.
Header
prg_list_funcs.h
Example:
/* Note: src_list_ptr points to the previously */
/* initialized and populated list of ElemT_Type. */
typedef struct {...} ElemT_Type;
PrgT_List *dest_list_ptr;
/* allocate and initialize new list for copy */
dest_list_ptr = prg_list_create();
prg_list_transfer (src_list_ptr, dest_list_ptr, sizeof (ElemT_Type));
Details
This function clears the destination list, then copies all elements from the source list to the destination list. Copying begins with the first element in the source list.
WARNING: This function is MT unsafe, as described in “Multi-Threading Safety“ on page 11. Access to shared lists must be externally serialized.
Purpose:
Provides a mechanism to copy elements of a fixed size from one linked list to another. This KP can be used when the elements were not allocated via known methods such as prg_mem_alloc(), prg_str_decomp(), or prg_gdf_read().
Errors:
- Program Abort: Segmentation violation. (due to invalid list pointer or malformed list)
- Recoverable Error: Unable to allocate memory for Prg list.
Reference:
- Use the KP
prg_list_elems_copy()to copy a source list whose elements were allocated by Riverbed memory allocation routines