set_init
void set_init(Set *set
, int (*match
)(const void *key1
, const void *key2
), void (*destroy
)(void *data
));
Initializes the set specified by
set
. This operation must be called for
a set before the set can be used with any other operation. The
match
argument is a function used by
various set operations to determine if two members match. It
should return 1 if key1
is equal to
key2
, and otherwise. The
destroy
argument provides a way to free
dynamically allocated data when set_destroy
is called. For example, if the set contains data dynamically
allocated using malloc,
destroy
should be set to
free to free the data as the set is
destroyed. For structured data containing several dynamically
allocated members, destroy
should be
set to a user-defined function that calls
free for each dynamically allocated member as
well as for the structure itself. For a set containing data that
should not be freed, destroy
should be
set to NULL.