lwip-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] (was Re: [lwip-devel] pbuf_chain followed by pbuf_free )


From: Leon Woestenberg
Subject: Re: [PATCH] (was Re: [lwip-devel] pbuf_chain followed by pbuf_free )
Date: Fri, 31 Oct 2003 20:15:20 +0100 (MET)

Hello Jani,

> > The documentation scares me.
> 
> I just copied what was there already :)
>
Yes, but the previous documentation was correct for what it does.

When a pbuf is chained, its reference count is increased as the
head of the chain references the tail. This is implicit.

The caller then in most cases (~7 out of 10 as you say) had to
explicitly give up its own reference calling pbuf_free().
 
> > I think this is more appropriate: (RFC)
> > 
> > /* Concatenate pbuf (chain) tail after pbuf (chain) head and remove
> > the
> >  * reference of the caller to the tail pbuf (chain).
> 
> It does not explicitely remove that reference right? Isn't this comment
> misleading? It more like takes over the reference.
>
It does remove the reference of the caller (as pbuf_free will be called) but
also adds the reference of the head. Netto result is no change of ref count.

Does the following improve clarity?

/* Concatenate two pbufs (each may be a pbuf chain) and take over
 * the reference of the tail pbuf.
 *
 * @note The caller MAY NOT reference the tail pbuf afterwards.
 *
 * @see pbuf_chain()
 */


Regards,

Leon.

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++





reply via email to

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