diff options
Diffstat (limited to 'core/util.c')
-rw-r--r-- | core/util.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/core/util.c b/core/util.c index 5b560171..d201bcb4 100644 --- a/core/util.c +++ b/core/util.c | |||
@@ -12,29 +12,34 @@ | |||
12 | #include "DHT.h" | 12 | #include "DHT.h" |
13 | #include "packets.h" | 13 | #include "packets.h" |
14 | 14 | ||
15 | uint64_t now() { | 15 | uint64_t now() |
16 | return time(NULL); | 16 | { |
17 | return time(NULL); | ||
17 | } | 18 | } |
18 | 19 | ||
19 | uint64_t random_64b() { | 20 | uint64_t random_64b() |
20 | uint64_t r; | 21 | { |
22 | uint64_t r; | ||
21 | 23 | ||
22 | // This is probably not random enough? | 24 | // This is probably not random enough? |
23 | r = random_int(); | 25 | r = random_int(); |
24 | r <<= 32; | 26 | r <<= 32; |
25 | r |= random_int(); | 27 | r |= random_int(); |
26 | 28 | ||
27 | return r; | 29 | return r; |
28 | } | 30 | } |
29 | 31 | ||
30 | bool ipp_eq(IP_Port a, IP_Port b) { | 32 | bool ipp_eq(IP_Port a, IP_Port b) |
31 | return (a.ip.i == b.ip.i) && (a.port == b.port); | 33 | { |
34 | return (a.ip.i == b.ip.i) && (a.port == b.port); | ||
32 | } | 35 | } |
33 | 36 | ||
34 | bool id_eq(clientid_t* dest, clientid_t* src) { | 37 | bool id_eq(clientid_t* dest, clientid_t* src) |
35 | return memcmp(dest, src, sizeof(clientid_t)) == 0; | 38 | { |
39 | return memcmp(dest, src, sizeof(clientid_t)) == 0; | ||
36 | } | 40 | } |
37 | 41 | ||
38 | void id_cpy(clientid_t* dest, clientid_t* src) { | 42 | void id_cpy(clientid_t* dest, clientid_t* src) |
39 | memcpy(dest, src, sizeof(clientid_t)); | 43 | { |
44 | memcpy(dest, src, sizeof(clientid_t)); | ||
40 | } | 45 | } |