[Asterisk-Dev] any reason for #define FREE in the code ?

Kevin P. Fleming kpfleming at digium.com
Wed Dec 28 14:08:40 MST 2005


Luigi Rizzo wrote:
> there are a few files, probably derived from some old template,
> that still have these blocks:
> 
> 	#ifdef __AST_DEBUG_MALLOC
> 	static void FREE(void *ptr)
> 	{
> 		free(ptr);
> 	}
> 	#else
> 	#define FREE free
> 	#endif

This is being done because there are API calls in those files that pass 
the _address_ of free() to another function, and when AST_DEBUG_MALLOC 
is enabled then free is a macro (with additional arguments), not a function.



More information about the asterisk-dev mailing list