PrgT_List_Compare_Proc

Abstract

Callback: Called to compare two list elements.

Syntax

PrgT_List_Compare_Proc (elem1_ptr, elem2_ptr)
Argument Type Description
elem1_ptr const void * The first element
elem2_ptr const void * The second element

Return Type

int

Result of the comparison (see Details).

prg.h

Details

This callback should accept two arguments that are both pointers to the type of data structure or simple data type elements stored in the list-of-interest. The callback should return one of the following values to indicate the precedence relationship between the two elements:

  • 1—if elem1 should be closer to the list head than elem2
  • 0—if elem1 and elem2 are equal in rank
  • -1—if elem2 should be closer to the list head than elem1

Two example comparison procedure declarations are shown below:

int
comp_proc1 (Packet *aptr, Packet *bptr)


int
comp_proc2 (char *aptr, char *bptr)

This callback is used by the following functions:

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