diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-07 15:32:56 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-07 15:32:56 +0000 |
commit | 5b0221f02c31cdba31f9f41cdf4e3a4f601b085e (patch) | |
tree | 429a6322b9bf65f6d8652d2f9bf16a50d59b6ac3 /mbuf.c | |
parent | 6b3fa17afdbbf844287750380fae74ebfeff73e8 (diff) | |
download | slirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.zip slirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.tar.gz slirp-5b0221f02c31cdba31f9f41cdf4e3a4f601b085e.tar.bz2 |
Sparse fixes: NULL use, header order, ANSI prototypes, static
Fix Sparse warnings:
* use NULL instead of plain 0
* rearrange header include order to avoid redefining types accidentally
* ANSIfy SLIRP
* avoid "restrict" keyword
* add static
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'mbuf.c')
-rw-r--r-- | mbuf.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -28,7 +28,7 @@ int mbuf_max = 0; */ #define SLIRP_MSIZE (IF_MTU + IF_MAXLINKHDR + sizeof(struct m_hdr) + 6) -void m_init() +void m_init(void) { m_freelist.m_next = m_freelist.m_prev = &m_freelist; m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist; @@ -42,7 +42,7 @@ void m_init() * free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE, * which tells m_free to actually free() it */ -struct mbuf *m_get() +struct mbuf *m_get(void) { register struct mbuf *m; int flags = 0; @@ -71,14 +71,14 @@ struct mbuf *m_get() m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr); m->m_data = m->m_dat; m->m_len = 0; - m->m_nextpkt = 0; - m->m_prevpkt = 0; + m->m_nextpkt = NULL; + m->m_prevpkt = NULL; end_error: DEBUG_ARG("m = %lx", (long)m); return m; } -void m_free(m) struct mbuf *m; +void m_free(struct mbuf *m) { DEBUG_CALL("m_free"); DEBUG_ARG("m = %lx", (long)m); @@ -110,7 +110,7 @@ void m_free(m) struct mbuf *m; * the other.. if result is too big for one mbuf, malloc() * an M_EXT data segment */ -void m_cat(m, n) register struct mbuf *m, *n; +void m_cat(struct mbuf *m, struct mbuf *n) { /* * If there's no room, realloc @@ -126,8 +126,7 @@ void m_cat(m, n) register struct mbuf *m, *n; /* make m size bytes large */ -void m_inc(m, size) struct mbuf *m; -int size; +void m_inc(struct mbuf *m, int size) { int datasize; @@ -160,8 +159,7 @@ int size; } -void m_adj(m, len) struct mbuf *m; -int len; +void m_adj(struct mbuf *m, int len) { if (m == NULL) return; @@ -180,8 +178,7 @@ int len; /* * Copy len bytes from m, starting off bytes into n */ -int m_copy(n, m, off, len) struct mbuf *n, *m; -int off, len; +int m_copy(struct mbuf *n, struct mbuf *m, int off, int len) { if (len > M_FREEROOM(n)) return -1; @@ -197,7 +194,7 @@ int off, len; * XXX This is a kludge, I should eliminate the need for it * Fortunately, it's not used often */ -struct mbuf *dtom(dat) void *dat; +struct mbuf *dtom(void *dat) { struct mbuf *m; |