man rlist_compare (Fonctions bibliothèques) - compare two lists for equality

NAME

rlist_compare - compare two lists for equality

SYNOPSIS

#include <roy.h>

typedef int (*RListComparatorFunction) (RListEntry *entry_a, RListEntry *entry_b);

int rlist_compare (RList * list_1, RList * list_2, RListComparatorFunction comparator);

DESCRIPTION

This call compares two lists for equality. Comparison stops immediatly if the two lists are of different length. Otherwise, each entry pair in the two lists are passed two by two into the comparator function as entry_a and entry_b. If the comparator function returns non zero at any point the comparison stops.

The comparator function should not return -1 because -1 is reserved for unequal length lists.

RETURN VALUE

The return of -1 indicates that list_1 and list_2 are of different lengths. If the comparitor function returns anthing other than zero (0) then the rlist_compare(3) call returns the same value, even if that value is -1. A return value of zero (0) indicates that the two lists are equal, anything else means they are unequal.

ERRORS

A call to rlist_compare(3) will never fail.

FUNCTION

The rlist_compare(3) api is implemented using a function.

SEE ALSO