prg_list_map()

Abstract

Applies the map function to elements of the list_ptr list.

Syntax

prg_list_map (list_ptr, mapfun, state)
Argument Type Description
list_ptr PrgT_List* pointer to the list-of-interest
mapfun PrgT_List_Map_Proc function applied to elements of the list.
state Vartype* state data passed to mapfun when mapfun is called.

Return Type

void

No return value

prg_list_funcs.h

Example:

/* read a GDF file */
routing_list_ptr = prg_gdf_read ("routing_table");

/* Print out the contents of the list by applying															*/
/* the ’printf’ function to its elements.															*/
prg_list_map (routing_list_ptr, printf, "%s\n");

Details

The mapping function mapfun is applied to each element of the list, starting at the head, until all elements are visited, or mapfun returns 0. The prototype for mapfun is given in PrgT_List_Map_Proc.

WARNING: This function is MT unsafe, as described in “Multi-Threading Safety“ on page 11. Access to shared lists must be externally serialized.

Purpose:

Iterates through the specified list, applying a user-specified function to some or all of its elements.

Errors:

  • Program Abort: Segmentation violation (due to an invalid list pointer or malformed list)

Reference:

  • None

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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