summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-11-09 22:54:39 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2009-11-09 22:54:39 +0100
commit3f22fa9e74c8643d3e4f7e3a7b4f2aa992ad09f5 (patch)
tree703e2606e1f01118098ad662f0ecc54c0c48fcd6 /lib
parenta6bc04d59130c49a1dbfadffa4285b11e2ff4939 (diff)
parentb7c0e93ebd40cdc4f6e89067a3e5f7293263c7f9 (diff)
downloadbird-3f22fa9e74c8643d3e4f7e3a7b4f2aa992ad09f5.tar
bird-3f22fa9e74c8643d3e4f7e3a7b4f2aa992ad09f5.zip
Merge branch 'dev' into ospf3
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)
{