Subject: m_length() function in "sys/mbuf.h"
To: None <tech-net@NetBSD.org>
From: Matthias Scheler <tron@zhadum.de>
List: tech-net
Date: 05/05/2005 12:20:33
	Hello,

is there a reason why the m_length() function defined in "sys/mbuf.h"
needs a local variable "m0". I think it could look like this:

static __inline u_int
m_length(struct mbuf *m)
{
	u_int pktlen;

	if ((m->m_flags & M_PKTHDR) != 0)
		return m->m_pkthdr.len;

	pktlen = 0;
	while (m != NULL) {
		pktlen += m->m_len;
		m = m->m_next;
	}
	return pktlen;
}

To be honest I'm not sure if that makes a difference for the code generated
by GCC. But it might speed up compilation a bit.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/