--- libelwix/inc/elwix/aindex.h 2022/01/04 22:32:34 1.1.2.1 +++ libelwix/inc/elwix/aindex.h 2022/01/05 23:03:40 1.1.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aindex.h,v 1.1.2.1 2022/01/04 22:32:34 misho Exp $ +* $Id: aindex.h,v 1.1.2.2 2022/01/05 23:03:40 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -61,9 +61,10 @@ struct tagIndex { typedef struct tagIndex index_t; /* - * index_get() - Get hash like list or first pointer + * index_getList() - Get hash like list or first pointer */ -#define index_get(x, k) (x)->i_hash[(k)] +#define index_getList(x, k) (x)->i_hash[(k)] +#define index_Next(x) (x)->il_next #define index_Hash(x) (x)->il_hash #define index_Len(x) (x)->il_len #define index_Ptr(x) (x)->il_ptr @@ -80,14 +81,14 @@ index_t *index_Init(index_t * __restrict idx); * index_FreeLists() - Free linked lists with data * * @idx = index - * return: no result + * return: none */ void index_FreeLists(index_t *idx); /* * index_Destroy() - Destroy index * * @idx = index - * return: no result + * return: none */ void index_Destroy(index_t **idx); @@ -114,6 +115,15 @@ int index_add(index_t *idx, unsigned short key, void * */ int index_del(index_t *idx, unsigned short key, void *data, int datlen); /* + * index_del2() - Dels item with index key and hash + * + * @idx = index + * @key = hash key + * @hash = calculated hash of item when its added to index + * return: -1 error, 0 nothing deleted and 1 item deleted + */ +int index_del2(index_t *idx, unsigned short key, unsigned int hash); +/* * index_delList() - Delete list behind key * * @idx = index @@ -148,6 +158,15 @@ index_list_t index_get2(index_t *idx, unsigned short k * return: NULL error or not found and !=NULL returned variable. Must be free after use! */ ait_val_t *index_getVar(index_t *idx, u_short key, u_int hash); + + +/* + * index_dump() - Debug routine about index hashes + * + * @idx = index + * return: none + */ +void index_dump(index_t *idx); #endif