Re: strange code in mem-pool.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Corin,

On Wed, Jan 14, 2009 at 6:53 PM, Corin Langosch <corinl@xxxxxx> 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@xxxxxxxxxx
http://lists.nongnu.org/mailman/listinfo/gluster-devel



--
Raghavendra G


[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux