summaryrefslogtreecommitdiff
path: root/ot_vector.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_vector.c')
-rw-r--r--ot_vector.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/ot_vector.c b/ot_vector.c
index 7d2a1a9..154d1c8 100644
--- a/ot_vector.c
+++ b/ot_vector.c
@@ -16,9 +16,6 @@
16#include "uint32.h" 16#include "uint32.h"
17#include "uint16.h" 17#include "uint16.h"
18 18
19#define READ16(addr,offs) ((int16_t)uint16_read((offs)+(uint8_t*)(addr)))
20#define READ32(addr,offs) ((int32_t)uint32_read((offs)+(uint8_t*)(addr)))
21
22static int vector_compare_peer(const void *peer1, const void *peer2 ) { 19static int vector_compare_peer(const void *peer1, const void *peer2 ) {
23 int32_t cmp = READ32(peer1,0) - READ32(peer2,0); 20 int32_t cmp = READ32(peer1,0) - READ32(peer2,0);
24 if (cmp == 0) cmp = READ16(peer1,4) - READ16(peer2,4); 21 if (cmp == 0) cmp = READ16(peer1,4) - READ16(peer2,4);
@@ -166,7 +163,7 @@ int vector_remove_peer( ot_vector *vector, ot_peer *peer ) {
166 match = binary_search_peer( peer, vector->data, vector->size, &exactmatch ); 163 match = binary_search_peer( peer, vector->data, vector->size, &exactmatch );
167 if( !exactmatch ) return 0; 164 if( !exactmatch ) return 0;
168 165
169 exactmatch = ( OT_FLAG( match ) & PEER_FLAG_SEEDING ) ? 2 : 1; 166 exactmatch = ( OT_PEERFLAG( match ) & PEER_FLAG_SEEDING ) ? 2 : 1;
170 memmove( match, match + 1, sizeof(ot_peer) * ( end - match - 1 ) ); 167 memmove( match, match + 1, sizeof(ot_peer) * ( end - match - 1 ) );
171 168
172 vector->size--; 169 vector->size--;