lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-devel] [bug #3031] Implement a new fully pool-based pbufimplem


From: Goldschmidt Simon
Subject: RE: [lwip-devel] [bug #3031] Implement a new fully pool-based pbufimplementation.
Date: Wed, 25 Jul 2007 13:19:07 +0200

onathan,

> I think most chains will be short enough that pbuf_clen() 
> isn't much of an issue - the biggest thing would be the 
> function call overhead itself, and to be honest, pbuf_clen() 
> is so short it should probably be made a function-like macro *anyway*.

I've been breaking my head how to implement pbuf_clen as a function-like
macro, but I can't think of anything... Here's how I could solve it:

#define pbuf_clen(p, len) \
{ \
  struct pbuf *q = (p) \
  (len) = 0; \
  while (q != NULL) { \
    ++(len); \
    q = q->next; \
  }\
}

But it would change the use of pbuf_clen from 'len = pbuf_clen(p)' to
'pbuf_clen(p, len)'.
Does anybody have an idea of how to implement this as a macro so that
len
is a return value instead of an argument??

Awaiting your ideas!

Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]