[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] pbuf_chain followed by pbuf_free
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-devel] pbuf_chain followed by pbuf_free |
Date: |
Fri, 31 Oct 2003 14:19:13 +0100 (MET) |
Hello Jani,
>
> > Hmm, I would prefer not changing the API and be suboptimal. Although,
> > did you look into which of the pbuf_chain()s are most often used,
> > those with or without _free()?
>
> well this happens on most pbuf_chain uses as I said, I noticed the one
> in tcp_out.c first.
>
I did not mean: how many times does it occur in the code. It meant: How many
times are the instances in the code called upon, in a running programming.
This
would need profiling, not looking at the code.
> For what it's worth the current pbuf_XX names are not self-descriptive
> either, but I can name pbuf_cat whatever else anybody suggests. It just
> concatenates two pbuf chains without refcount touching.
>
> > This is much clearer in the current situation, where the caller
> > explicitly calls pbuf_free(tail)
> > and where the programmer is enforced not to reference tail afterwards.
>
> Could you explain this? How is he forced not to reference tail? tail is
> not set to NULL, it is still a valid pbuf with a refcount of at least 1.
>
The same as with the free(p) call in the C library, the programmer is aware
that the p pointer should no longer be referenced afterwards.
For the caller, the fact that p still exists after free(p) is irrelevant.
> So if you agree (and I suppose you do since you proposed what I
> intended to express in my first mail I'll do the change)
> OK?
>
Sure, fine with me! Succes!
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! +++