Bill Pringlemeir wrote:
> On 20 Jan 2007, [EMAIL PROTECTED] wrote:
> > This is clearly bogus because the function doesn't check for
> > NULL. We should however always use G_FREE_NULL() like most of the
> > code already does. I've fixed it similar to your suggestion.
> I did see that macro after posting. It also helps to prevent double
> frees. However, an alternative is to change the memory logging code.
> I guess that is more a philosophical debate. I think explicitly
> handling NULLs separate seems to be the general consensus in GTKG.
It also prevents dangling pointers, if we always nullify pointers after freeing
some memory object and it makes the code more readable as well as compact if
you can write
G_FREE_NULL(p);
instead of
if (p) {
g_free(p);
p = NULL;
}
Nullifying pointers after free() doesn't seem to be a popular practice though.
--
Christian
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Gtk-gnutella-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel