/Users/maurits/Documents/studie/afstuderen/biosphere/common/list.c File Reference

#include "list.h"
#include "alloc.h"
#include <assert.h>
#include <apr_pools.h>

Include dependency graph for list.c:

Go to the source code of this file.

Defines

#define INITIAL_LIST_SIZE   16

Functions

bs_listnew_list (apr_pool_t *mp)
void delete_list (bs_list *list)
void list_remove (bs_list *l, unsigned index)
void list_append (bs_list *list, void *data)
void list_insert (bs_list *l, unsigned index, void *data)
void list_merge (bs_list *list_1, bs_list *list_2)
unsigned list_size (const bs_list *list)
void * list_index (const bs_list *list, unsigned index)


Define Documentation

#define INITIAL_LIST_SIZE   16

Definition at line 41 of file list.c.

Referenced by new_list().


Function Documentation

void delete_list ( bs_list l  ) 

Deallocate a list. NOTE: This does not deallocate the items in the list since the list is unaware of the type of data it contains.

Parameters:
l The list to be deleted.

Definition at line 65 of file list.c.

References bs_list::pool.

Referenced by bsmod_stat_cleanup(), and list_merge().

void list_append ( bs_list l,
void *  data 
)

Append a _single_ data item to the list; the length of the list is increased by one

Parameters:
l The list to append the data item to
data The data item to append

Definition at line 85 of file list.c.

References bs_list::allocated, bs_list::data, bs_list::pool, pool_realloc(), and bs_list::size.

Referenced by add_node(), add_service(), add_to_socket_list(), add_user(), bsmod_password_init(), bsmod_stat_handle_start_timer(), get_module_descriptions(), init_options(), list_insert(), list_merge(), load_module(), and strtokenize().

Here is the call graph for this function:

void* list_index ( const bs_list l,
unsigned  index 
) [inline]

Return the 'index'th item in the list First item has index 0.

Parameters:
l The list to retrieve the data item from
index The index of the data item

Definition at line 141 of file list.c.

References bs_list::data.

Referenced by add_node(), add_service(), add_user(), bsmod_password_cleanup(), bsmod_password_handle_service(), bsmod_password_init(), bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), bsmod_stat_handle_start_timer(), bsmod_stat_handle_stop_timer(), core_service_module_service_list(), dict_add(), dict_get(), dict_remove(), get_module_descriptions(), get_module_info(), get_services(), get_servicing_node(), handle_service_request(), init_module(), node_already_known(), remove_from_socket_list(), remove_node(), remove_oldest_thread(), remove_service(), remove_user(), shutdown_thread_main(), unload_all_modules(), and unload_module().

void list_insert ( bs_list l,
unsigned  index,
void *  data 
)

Insert a data item at a given index in the list. Data items with a greater index will be moved to the right.

Parameters:
l List to insert into
index Index the data item must be inserted at
data The data item to insert.

Definition at line 101 of file list.c.

References bs_list::allocated, bs_list::data, list_append(), bs_list::pool, pool_realloc(), and bs_list::size.

Referenced by add_node().

Here is the call graph for this function:

void list_merge ( bs_list l,
bs_list l2 
)

Merge two lists. This will move all items from the second list to the first and then delete the second list.

Parameters:
l The first of the lists to be merged
l2 The second of the lists to be merged

Definition at line 122 of file list.c.

References bs_list::data, delete_list(), list_append(), and bs_list::size.

Here is the call graph for this function:

void list_remove ( bs_list l,
unsigned  index 
)

Remove an entry in the list at the specified index.

Parameters:
l The list to remove the entry from.
index The index of that entry.

Definition at line 73 of file list.c.

References bs_list::data, and bs_list::size.

Referenced by dict_remove(), remove_from_socket_list(), remove_node(), remove_service(), remove_user(), unload_all_modules(), and unload_module().

unsigned list_size ( const bs_list l  )  [inline]

Return the number of items in the list

Parameters:
l The list to retrieve the size form

Definition at line 134 of file list.c.

References bs_list::size.

Referenced by add_node(), add_service(), add_user(), bsmod_password_cleanup(), bsmod_password_handle_service(), bsmod_password_init(), bsmod_stat_handle_avgminmax(), bsmod_stat_handle_gather_times(), bsmod_stat_handle_start_timer(), bsmod_stat_handle_stop_timer(), core_service_module_service_list(), dict_add(), dict_get(), dict_remove(), get_module_descriptions(), get_module_info(), get_services(), get_servicing_node(), handle_service_request(), init_module(), lets_go_threaded(), node_already_known(), remove_from_socket_list(), remove_node(), remove_oldest_thread(), remove_service(), remove_user(), shutdown_thread_main(), unload_all_modules(), and unload_module().

bs_list* new_list ( apr_pool_t *  mp  ) 

Create a new list and allocate memory for it. List have their own memory subpool which is created from the given memory pool

Parameters:
mp Memory pool to create a subpool from
Returns:
The new list

Definition at line 44 of file list.c.

References bs_list::allocated, bs_list::data, INITIAL_LIST_SIZE, pool, bs_list::pool, runtestsuite::rv, and bs_list::size.

Referenced by bsmod_password_init(), bsmod_stat_handle_avgminmax(), bsmod_stat_init(), core_service_module_service_list(), dict_add(), init_defaults(), init_module(), init_node(), init_service(), and init_threadsystem().


Generated on Tue Jul 17 09:50:57 2007 for Bio-SPHERE by  doxygen 1.5.1