diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/birdlib.h | 7 | ||||
-rw-r--r-- | lib/hash.h | 8 | ||||
-rw-r--r-- | lib/socket.h | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h index 904544cb..37337078 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -62,6 +62,13 @@ #define UNUSED __attribute__((unused)) #define PACKED __attribute__((packed)) +#ifdef IPV6 +#define UNUSED4 +#define UNUSED6 UNUSED +#else +#define UNUSED4 UNUSED +#define UNUSED6 +#endif /* Microsecond time */ @@ -2,7 +2,7 @@ #define HASH(type) struct { type **data; uint count, order; } #define HASH_TYPE(v) typeof(** (v).data) -#define HASH_SIZE(v) (1 << (v).order) +#define HASH_SIZE(v) (1U << (v).order) #define HASH_EQ(v,id,k1,k2...) (id##_EQ(k1, k2)) #define HASH_FN(v,id,key...) ((u32) (id##_FN(key)) >> (32 - (v).order)) @@ -116,12 +116,12 @@ #define HASH_MAY_RESIZE_DOWN_(v,pool,rehash_fn,args) \ ({ \ - int _o = (v).order; \ - while (((v).count < ((1 << _o) REHASH_LO_MARK(args))) && \ + uint _o = (v).order; \ + while (((v).count < ((1U << _o) REHASH_LO_MARK(args))) && \ (_o > (REHASH_LO_BOUND(args)))) \ _o -= (REHASH_LO_STEP(args)); \ if (_o < (v).order) \ - rehash_fn(&(v), pool, _o - (int) (v).order); \ + rehash_fn(&(v), pool, _o - (v).order); \ }) diff --git a/lib/socket.h b/lib/socket.h index 6babfa7b..2da52127 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -30,7 +30,7 @@ typedef struct birdsock { byte *rbuf, *rpos; /* NULL=allocate automatically */ uint fast_rx; /* RX has higher priority in event loop */ uint rbsize; - int (*rx_hook)(struct birdsock *, int size); /* NULL=receiving turned off, returns 1 to clear rx buffer */ + int (*rx_hook)(struct birdsock *, uint size); /* NULL=receiving turned off, returns 1 to clear rx buffer */ byte *tbuf, *tpos; /* NULL=allocate automatically */ byte *ttx; /* Internal */ |