[Gluster-devel] strange code in mem-pool.h

Raghavendra G raghavendra at zresearch.com
Wed Jan 14 18:27:53 UTC 2009


Hi Corin,

On Wed, Jan 14, 2009 at 6:53 PM, Corin Langosch <corinl at gmx.de> wrote:

> Hi all,
>
> while working on my second patch I wonder about this peace of code in
> mem-pool.h:
>
> #define FREE(ptr)                \
>    if (ptr != NULL) {            \
>        free ((void *)ptr);        \
>        ptr = (void *)0xeeeeeeee;    \
>    }
>
> Why is the pointer not set to NULL?


Because the probability of NULL being a valid value of pointer is more than
0xeeeeeeee being the value of pointer. By observing the value of pointer to
be 0xeeeeeeeee we can judge it to be FREEd during debugging process.

regards,

>
>
> Corin
>
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at nongnu.org
> http://lists.nongnu.org/mailman/listinfo/gluster-devel
>



-- 
Raghavendra G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20090114/7464c09b/attachment-0003.html>


More information about the Gluster-devel mailing list