HTP  0.3
Functions
dslib.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "dslib.h"
Include dependency graph for dslib.c:

Functions

void list_linked_destroy (list_linked_t **_l)
list_tlist_linked_create (void)
void list_array_iterator_reset (list_array_t *l)
void * list_array_iterator_next (list_array_t *l)
void list_array_destroy (list_array_t **_l)
list_tlist_array_create (size_t size)
table_ttable_create (size_t size)
void table_destroy (table_t **_table)
int table_add (table_t *table, bstr *key, void *element)
int table_addn (table_t *table, bstr *key, void *element)
void * table_get_c (const table_t *table, const char *cstr)
void * table_get (const table_t *table, const bstr *key)
void table_iterator_reset (table_t *table)
bstrtable_iterator_next (table_t *t, void **data)
size_t table_size (const table_t *table)
void table_clear (table_t *table)

Detailed Description

Author:
Ivan Ristic ivanr.nosp@m.@web.nosp@m.kreat.nosp@m.or.c.nosp@m.om

Function Documentation

list_t* list_array_create ( size_t  size)

Create new array-based list.

Parameters:
size
Returns:
newly allocated list (list_t)

Here is the call graph for this function:

Here is the caller graph for this function:

void list_array_destroy ( list_array_t **  _l)

Free the memory occupied by this list. This function assumes the data elements were freed beforehand.

Parameters:
l

Here is the caller graph for this function:

void* list_array_iterator_next ( list_array_t l)

Advance to the next list value.

Parameters:
l
Returns:
the next list value, or NULL if there aren't more elements left to iterate over or if the element itself is NULL

Here is the caller graph for this function:

void list_array_iterator_reset ( list_array_t l)

Reset the list iterator.

Parameters:
l

Here is the caller graph for this function:

list_t* list_linked_create ( void  )

Create a new linked list.

Returns:
a pointer to the newly created list (list_t), or NULL on memory allocation failure

Here is the call graph for this function:

void list_linked_destroy ( list_linked_t **  _l)

Destroy list. This function will not destroy any of the data stored in it. You'll have to do that manually beforehand.

Parameters:
l

Here is the caller graph for this function:

int table_add ( table_t table,
bstr key,
void *  element 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int table_addn ( table_t table,
bstr key,
void *  element 
)

Add a new table element. This function currently makes a copy of the key, which is inefficient.

Parameters:
table
key
element

Here is the caller graph for this function:

void table_clear ( table_t table)

Remove all elements from the table.

Parameters:
table

Here is the call graph for this function:

Here is the caller graph for this function:

table_t* table_create ( size_t  size)

Create a new table structure.

Parameters:
size
Returns:
newly created table_t

Here is the call graph for this function:

Here is the caller graph for this function:

void table_destroy ( table_t **  _table)

Destroy a table.

Parameters:
table

Here is the caller graph for this function:

void* table_get ( const table_t table,
const bstr key 
)

Retrieve the first element in the table with the given key.

Parameters:
table
key
Returns:
table element, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

void* table_get_c ( const table_t table,
const char *  cstr 
)
Parameters:
table
keyRetrieve the first element in the table with the given key (as a NUL-terminated string).
table
cstr
Returns:
table element, or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

bstr* table_iterator_next ( table_t t,
void **  data 
)

Advance to the next table element.

Parameters:
t
data
Returns:
pointer to the key and the element if there is a next element, NULL otherwise

Here is the caller graph for this function:

void table_iterator_reset ( table_t table)

Reset the table iterator.

Parameters:
table

Here is the caller graph for this function:

size_t table_size ( const table_t table)

Returns the size of the table.

Parameters:
table
Returns:
table size

Here is the caller graph for this function: