apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uwe Zeisberger <zeisb...@informatik.uni-freiburg.de>
Subject apr_pcalloc resulting in segfault
Date Thu, 31 Mar 2005 13:08:04 GMT

in apr_pools.h[1] the following is defined:

	#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)

If I don't set an abort function and an allocation with palloc fails,
this results in a segfault.

There is still a function with this name, so removing the macro would
fix this and should be as compatible as required.

I see no way to implement this in a save manner as macro.  One would
need something like:

	#define apr_pcalloc(p, size) \
		(void *__t = apr_palloc(p, size), __t ? memset(__t, 0, size), __t)

but I think this doesn't work, or at least is not portable.

Additionally it would be nice, if in the documentation would appear,
which functions are realized as macros, above all because sometimes the
arguments are evaluated more than once.


[1] This is true for HEAD, apr-0.9.x and apr-1.x

Uwe Zeisberger


View raw message