Hash list.
More...
Detailed Description
Hash list.
Functions for handling string based hash lists. Think of it as sgeArray with a character string as index instead of a integer.
Typedef Documentation
iterator function
- Parameters:
-
| id | the element key |
| data | the element data |
- See also:
- sgeListForEach
Definition at line 66 of file sgelist.h.
Function Documentation
add a element on the hash index id
- Parameters:
-
| l | hash list to add the element to |
| id | the hash key as string |
| data | the actual element data |
- Returns:
- a pointer to the new element as SGELISTENTRY
Definition at line 21 of file sgelist.c.
destroy a hash list
Elements are not freed, you have to free them yourself before destroying
Definition at line 113 of file sgelist.c.
iterate over a hash list
- Parameters:
-
| l | the hash list to iterate over |
| function | a function |
The function gets the id (char *) and the data (void *) of the element.
Definition at line 105 of file sgelist.c.
insert a element before a certain element
- Parameters:
-
| l | the hash list to change |
| le | the element where to insert before |
| id | the hash key as string |
| data | the actual element data |
- Returns:
- a pointer to the new element as SGELISTENTRY
Definition at line 51 of file sgelist.c.
create a new hash list
- Returns:
- the new list as SGELIST pointer
Elements have to be freed yourself, after/before removing from the list.
Definition at line 11 of file sgelist.c.
| void sgeListRemove |
( |
SGELIST * |
l, |
|
|
char * |
id |
|
) |
| |
remove a element from a list
- Parameters:
-
| l | the hash list to remove the element from |
| id | the key of the element to remove |
element data is not freed, usually you want to first search for the element and free the data before calling this.
Definition at line 82 of file sgelist.c.
search a element in the hash list
- Parameters:
-
| l | the hash list to search in |
| id | the key to search for |
- Returns:
- the element as SGELISTENTRY pointer or NULL of not found
Definition at line 72 of file sgelist.c.