[Was] Resolving the licensing issues.

Tito farmatito at tiscali.it
Fri Mar 3 14:41:40 UTC 2006


On Friday 03 March 2006 11:07, Denis Vlasenko wrote:
> On Friday 03 March 2006 11:29, Steven Scholz wrote:
> > Bernd Petrovitsch wrote:

snip

> BTW, ext2fs code already has "free which also sets ptr to NULL"
> and it takes a pointer to pointer:
> 
> errcode_t ext2fs_free_mem(void *ptr)
> {
>         void **pp = (void **)ptr;
>         free(*pp);
>         *pp = 0;
>         return 0;
> }
> (Wow. why does it return a value?)
> 

So maybe :

 void bb_free(void *ptr)
{
       void **pp = (void **)ptr;
       free(*pp);
        *pp = 0;
 }

and than

bb_free(&some_ptr);

>Another thing. xfree(), xmalloc() etc are rather non-informative:

xfunctions usually are the one one that die on error
so xmalloc / xcalloc / xrealloc    are ok imho.

>xfree - free and set to null? or free if CONFIG_FEATURE_CLEAN_UP?

maybe bb_free  as it doesn't die on error ?

BTW: this is the standard we used in all  in libbb/bb_pwd.c

ciao,
Tito

>I think it makes sense to give more meaningful names:
>free_and_null(), malloc_or_die().
> vda
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox
> 



More information about the busybox mailing list