Mission Base

Program Base Library Functions

void* pblListSetCompareFunction

( PblList* list,
  int (* compare ) ( const void* prev,
  const void* next ) )

Sets an application specific compare function for the elements of the list.

Documentation

Sets an application specific compare function for the elements of the list.

An application specific compare function can be set to the list. If no specific compare function is specified by the user, the default compare function is used. The default compare function compares the two pointers directly, i.e. it tests for object identity.

The compare function specified should behave like the one that can be specified for the C-library function 'qsort'.

The arguments actually passed to the compare function when it is called are addresses of the element pointers added to the list. E.g.: If you add char * pointers to the list, the compare function will be called with char ** pointers as arguments. See the documentation for the C-library function 'qsort' for further information.

This method has a time complexity of O(1).

Parameters:
list - The list to set compare function for
compare - The compare function to set
prev - The "left" element for compare
next - The "right" element for compare
Returns:
* retptr: The compare function used before, may be NULL.

Alphabetic index



This page was generated with the help of DOC++.