source: trunk/libtransmission/list.h @ 2306

Last change on this file since 2306 was 2306, checked in by charles, 14 years ago

remove the "peer is asking for too many blocks!" warning reported by Gimp_ by changing from a fixed-size array to a linked lists of incoming requests

File size: 1.2 KB
Line 
1/*
2 * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 */
10
11#ifndef TR_LIST_H
12#define TR_LIST_H
13
14typedef struct tr_list_s
15{
16    void              * data;
17    struct tr_list_s  * next;
18    struct tr_list_s  * prev;
19}
20tr_list_t;
21
22void        tr_list_free_1   ( void );
23void        tr_list_free     ( tr_list_t* );
24int         tr_list_length   ( const tr_list_t* );
25tr_list_t*  tr_list_append   ( tr_list_t*, void * data );
26tr_list_t*  tr_list_prepend  ( tr_list_t*, void * data );
27tr_list_t*  tr_list_remove   ( tr_list_t*, const void * data );
28tr_list_t*  tr_list_pop      ( tr_list_t*, void ** setme );
29
30typedef int (*TrListCompareFunc)(const void * a, const void * b);
31tr_list_t*  tr_list_find      ( tr_list_t*, TrListCompareFunc func, const void * b );
32tr_list_t*  tr_list_find_data ( tr_list_t*, const void * data );
33
34typedef void (*TrListForeachFunc)(void *);
35void tr_list_foreach( tr_list_t*, TrListForeachFunc func );
36
37#endif /* TR_LIST_H */
38
Note: See TracBrowser for help on using the repository browser.