From 1b8b89ab32a670ae5569eb2305e03c563ebe89ab Mon Sep 17 00:00:00 2001 From: bms Date: Tue, 16 Dec 2003 14:13:47 +0000 Subject: style(9) pass and type fixups. Submitted by: bde --- sys/kern/uipc_mbuf.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'sys/kern/uipc_mbuf.c') diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 52b6bb1..aa6e532 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -761,14 +761,13 @@ out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) */ int m_apply(struct mbuf *m, int off, int len, - int (*f)(void *, caddr_t, unsigned int), void *arg) + int (*f)(void *, void *, u_int), void *arg) { - unsigned int count; + u_int count; int rval; KASSERT(off >= 0, ("m_apply, negative off %d", off)); KASSERT(len >= 0, ("m_apply, negative len %d", len)); - while (off > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); if (off < m->m_len) @@ -779,16 +778,13 @@ m_apply(struct mbuf *m, int off, int len, while (len > 0) { KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain")); count = min(m->m_len - off, len); - rval = (*f)(arg, mtod(m, caddr_t) + off, count); if (rval) return (rval); - len -= count; off = 0; m = m->m_next; } - return (0); } @@ -800,25 +796,23 @@ m_getptr(struct mbuf *m, int loc, int *off) { while (loc >= 0) { - /* Normal end of search */ + /* Normal end of search. */ if (m->m_len > loc) { *off = loc; return (m); } else { loc -= m->m_len; - if (m->m_next == NULL) { if (loc == 0) { - /* Point at the end of valid data */ + /* Point at the end of valid data. */ *off = m->m_len; return (m); - } else - return (NULL); - } else - m = m->m_next; + } + return (NULL); + } + m = m->m_next; } } - return (NULL); } -- cgit v1.1