summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/birdlib.h2
-rw-r--r--lib/event.c4
-rw-r--r--lib/mempool.c5
-rw-r--r--lib/resource.c6
-rw-r--r--lib/slab.c1
-rw-r--r--lib/socket.h2
6 files changed, 8 insertions, 12 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h
index b7cd6b4..12a581b 100644
--- a/lib/birdlib.h
+++ b/lib/birdlib.h
@@ -13,7 +13,7 @@
/* Ugly structure offset handling macros */
-#define OFFSETOF(s, i) ((unsigned int)&((s *)0)->i)
+#define OFFSETOF(s, i) ((size_t) &((s *)0)->i)
#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
#define BIRD_ALIGN(s, a) (((s)+a-1)&~(a-1))
diff --git a/lib/event.c b/lib/event.c
index 55a9c48..d556cd0 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -63,10 +63,6 @@ event *
ev_new(pool *p)
{
event *e = ralloc(p, &ev_class);
-
- e->hook = NULL;
- e->data = NULL;
- e->n.next = NULL;
return e;
}
diff --git a/lib/mempool.c b/lib/mempool.c
index e6f277b..0cb06b5 100644
--- a/lib/mempool.c
+++ b/lib/mempool.c
@@ -19,6 +19,7 @@
*/
#include <stdlib.h>
+#include <stdint.h>
#include "nest/bird.h"
#include "lib/resource.h"
@@ -64,13 +65,9 @@ linpool
*lp_new(pool *p, unsigned blk)
{
linpool *m = ralloc(p, &lp_class);
- m->ptr = m->end = NULL;
- m->first = m->current = NULL;
m->plast = &m->first;
- m->first_large = NULL;
m->chunk_size = blk;
m->threshold = 3*blk/4;
- m->total = m->total_large = 0;
return m;
}
diff --git a/lib/resource.c b/lib/resource.c
index 8f91450..5ba23f1 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include "nest/bird.h"
#include "lib/resource.h"
@@ -183,13 +184,14 @@ rdump(void *res)
*
* This function is called by the resource classes to create a new
* resource of the specified class and link it to the given pool.
- * Size of the resource structure is taken from the @size field
- * of the &resclass.
+ * Allocated memory is zeroed. Size of the resource structure is taken
+ * from the @size field of the &resclass.
*/
void *
ralloc(pool *p, struct resclass *c)
{
resource *r = xmalloc(c->size);
+ bzero(r, c->size);
r->class = c;
add_tail(&p->inside, &r->n);
diff --git a/lib/slab.c b/lib/slab.c
index 17511d2..8cce52f 100644
--- a/lib/slab.c
+++ b/lib/slab.c
@@ -26,6 +26,7 @@
*/
#include <stdlib.h>
+#include <stdint.h>
#include "nest/bird.h"
#include "lib/resource.h"
diff --git a/lib/socket.h b/lib/socket.h
index 0ab7d95..f44e8e8 100644
--- a/lib/socket.h
+++ b/lib/socket.h
@@ -53,13 +53,13 @@ int sk_set_ttl(sock *s, int ttl); /* Set TTL for given socket */
/* Add or remove security associations for given passive socket */
int sk_set_md5_auth(sock *s, ip_addr a, char *passwd);
+int sk_rx_ready(sock *s);
/* Prepare UDP or IP socket to multicasting. s->iface and s->ttl must be set */
int sk_setup_multicast(sock *s);
int sk_join_group(sock *s, ip_addr maddr);
int sk_leave_group(sock *s, ip_addr maddr);
-
static inline int
sk_send_buffer_empty(sock *sk)
{