On Friday 28 September 2007 18:39:19 Natanael Copa wrote:
> On Fri, 2007-09-28 at 17:51 +0200, Loïc Grenié wrote:
> > These are three patches for busybox.
> > 
> > 1) The first one adds a function xfree(ptr) to xfuncs.c which acts
> >     as if (ptr) free(ptr) and substitute some examples of such
> >     elements in the code. I don't remember whether such a
> >     function is necessary or whether free() itself already checks
> >     for null pointer.
> 
> from man 3 free:
> 
>  If ptr is NULL, no operation is performed.
> 
> -nc
Maybe this version could be more useful.....

void xfree(void *ptr)
{
        /*       sets the pointer to NULL
                after it has been freed.*/
        void **pp = (void **)ptr;

        if (*pp == NULL) return;

        free(*pp);
        *pp = NULL;
}


just my 0,2 cent.  ;-)

Ciao,
Tito
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to