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.

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

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com