afc_nodemaster_sort

Name

afc_nodemaster_sort  -- Sorts the item in the NodeMaster

Synopsis

void * afc_nodemaster_sort (NodeMaster * nm, signed long (*sortingroutine) (void *, void *, void *), void * info);

Description

Use this method to sort the list.

Inputs

nm

Pointer to a valid NodeMaster class.

sortingroutine

You MUST provide a comparison routine, which will be used to sort your list. The comp routine should accept three params: item1, item2 and info. Item1 and item2 are the two items you should compare; while info is an optional param containing to whatever you want. Your comp routine MUST return a value:

>1

Item1 > Item2

=0

Item1 = Item2

<0

Item1 < Item2 Then items will be sorted accordingly by the sort method.

info

This is an optional param that will be passed to your comp routine. It can contain everything you like.

Result

The new first object in the list

The list has been sorted correctly

NULL

sort failed (maybe list empty)

Note

See Also