Raphael Manfredi wrote:
> Quoting Christian Biere <[EMAIL PROTECTED]> from ml.softs.gtk-gnutella.devel:
> :I don't see what lookup_is_alive() is good for. It is not valid C if the
> :pointer actually references a freed object as per C standard section 6.2.4. 
> If
> :you want to use weak references, look at core/nodes.c and "node_id". You have
> :to use numeric IDs, not pointers to track objects beyond their life-cycle.
 
> This code is perfectly valid as the pointer is used only as an integer here,
> as a key in the hash table, and is never de-referenced unless it is valid

Nobody said a word about dereferencing and if you had actually read the
section, you'd know that just using the pointer's value leads to
undefined behavior.

> (presence in the table means the pointer is valid).

Then you don't need the check for "lid" at all. If it's supposed to be a
consistency check that's fine but then it should be an assertion check.
If you intend to leave dangling pointers in the table and use the check
to avoid recycled memory, then it's not.

> Anyway, this is not the problem here.

Again, I didn't say anything like that. It is a problem that became
only apparent to me due to another around this code.

-- 
Christian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gtk-gnutella-devel mailing list
gtk-gnutella-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to