DLL(3X)

NAME
dll_create, dll_destroy, dll_insert, dll_insert_uniq, dll_delete, dll_search, dll_minimum, dll_maximum, dll_successor, dll_predecessor, dll_iterate, dll_nextobj - double linked list management functions

SYNOPSIS

#include "dll.h"

dict_h dll_create( oo_compare, ko_compare, flags, errnop )
int (*oo_compare)( dict_obj, dict_obj ) ;
int (*ko_compare)( dict_key, dict_obj ) ;
int flags ;
int *errnop ;

void dll_destroy( handle )
dict_h handle ;

int dll_insert( handle, object )
dict_h handle ;
dict_obj object ;

int dll_insert_uniq( handle, object, objectp )
dict_h handle ;
dict_obj object ;
dict_obj *objectp ;

int dll_delete( handle, object )
dict_h handle ;
dict_obj object ;

dict_obj dll_search( handle, key )
dict_h handle ;
dict_key key ;

dict_obj dll_minimum( handle )
dict_h handle ;

dict_obj dll_maximum( handle )
dict_h handle ;

dict_obj dll_successor( handle, object )
dict_h handle ;
dict_obj object ;

dict_obj dll_predecessor( handle, object )
dict_h handle ;
dict_obj object ;

void dll_iterate( handle, direction )
dict_h handle ;
enum dict_direction direction ;

dict_obj dll_nextobj( handle )
dict_h handle ;

DESCRIPTION

This library supports dictionary functions using double linked lists. It follows the standard library interface which is explained in dict(3). The flags supported by dll_create() include:

    DICT_RETURN_ERROR

    DICT_UNIQUE_KEYS

    DICT_UNORDERED

    DICT_ORDERED

If the flag DICT_UNORDERED is used when a list is created, a dll_insert() operation will always insert an object at the beginning of the list. This allows such a list to be used to enforce an LRU policy by deleting the most recently found node and inserting it back.

dll_minimum() returns the object with the minimum key value if the list is sorted, or the object at the beginning of the list if the list is not sorted.

dll_maximum() returns the object with the maximum key value if the list is sorted, or the object at the end of the list if the list is not sorted.

SEE ALSO
dict(3)

RETURN VALUES
Check dict(3) for function return values and error codes.