2007-07-09 04:37:16 +00:00
|
|
|
/*
|
2008-01-01 17:20:20 +00:00
|
|
|
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
|
2007-07-09 04:37:16 +00:00
|
|
|
*
|
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
2008-09-23 19:11:04 +00:00
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
2007-07-09 04:37:16 +00:00
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
2007-08-18 17:05:51 +00:00
|
|
|
*
|
2007-08-18 17:19:49 +00:00
|
|
|
* $Id$
|
2007-07-09 04:37:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TR_LIST_H
|
|
|
|
#define TR_LIST_H
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
typedef struct tr_list
|
2007-07-09 04:37:16 +00:00
|
|
|
{
|
2008-09-23 19:11:04 +00:00
|
|
|
void * data;
|
2007-09-20 16:32:01 +00:00
|
|
|
struct tr_list * next;
|
|
|
|
struct tr_list * prev;
|
2007-07-09 04:37:16 +00:00
|
|
|
}
|
2007-09-20 16:32:01 +00:00
|
|
|
tr_list;
|
2007-07-09 04:37:16 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
typedef int ( *TrListCompareFunc )( const void * a, const void * b );
|
|
|
|
typedef void ( *TrListForeachFunc )( void * );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
int tr_list_size( const tr_list * list );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_list_free( tr_list ** list,
|
|
|
|
TrListForeachFunc data_free_func );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_list_append( tr_list ** list,
|
|
|
|
void * data );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_list_prepend( tr_list ** list,
|
|
|
|
void * data );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void* tr_list_pop_front( tr_list ** list );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void* tr_list_remove_data( tr_list ** list,
|
|
|
|
const void * data );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void* tr_list_remove( tr_list ** list,
|
|
|
|
const void * b,
|
|
|
|
TrListCompareFunc compare_func );
|
2007-08-14 14:18:54 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_list_insert_sorted( tr_list ** list,
|
|
|
|
void * data,
|
|
|
|
TrListCompareFunc compare_func );
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
tr_list* tr_list_find( tr_list * list,
|
|
|
|
const void * b,
|
|
|
|
TrListCompareFunc compare_func );
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
tr_list* tr_list_find_data( tr_list * list,
|
|
|
|
const void * data );
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_list_foreach( tr_list * list,
|
|
|
|
TrListForeachFunc foreach_func );
|
2007-07-09 04:37:16 +00:00
|
|
|
|
|
|
|
#endif /* TR_LIST_H */
|
|
|
|
|