diff options
Diffstat (limited to 'ot_vector.h')
-rw-r--r-- | ot_vector.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ot_vector.h b/ot_vector.h new file mode 100644 index 0000000..8863855 --- /dev/null +++ b/ot_vector.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* This software was written by Dirk Engling <erdgeist@erdgeist.org> | ||
2 | It is considered beerware. Prost. Skol. Cheers or whatever. */ | ||
3 | |||
4 | #ifndef __OT_VECTOR_H__ | ||
5 | #define __OT_VECTOR_H__ | ||
6 | |||
7 | #include "trackerlogic.h" | ||
8 | |||
9 | #define OT_VECTOR_MIN_MEMBERS 4 | ||
10 | #define OT_VECTOR_GROW_RATIO 8 | ||
11 | #define OT_VECTOR_SHRINK_THRESH 6 | ||
12 | #define OT_VECTOR_SHRINK_RATIO 4 | ||
13 | typedef struct { | ||
14 | void *data; | ||
15 | size_t size; | ||
16 | size_t space; | ||
17 | } ot_vector; | ||
18 | |||
19 | void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size, | ||
20 | size_t compare_size, int *exactmatch ); | ||
21 | void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch ); | ||
22 | |||
23 | int vector_remove_peer( ot_vector *vector, ot_peer *peer, int hysteresis ); | ||
24 | void vector_remove_torrent( ot_vector *vector, ot_torrent *match ); | ||
25 | |||
26 | #endif \ No newline at end of file | ||