If M_PKTHDR is set then we don't need to do a loop to find the total length.

This commit is contained in:
Darren Reed 2002-09-19 01:21:24 +00:00
parent bf4dc8772e
commit e62497713c

View File

@ -727,6 +727,9 @@ m_length(struct mbuf *m0, struct mbuf **last)
struct mbuf *m;
u_int len;
if ((m0->m_flags & M_PKTHDR) != 0)
return m->m_pkthdr.len;
len = 0;
for (m = m0; m != NULL; m = m->m_next) {
len += m->m_len;