On Fri, Feb 22, 2013 at 04:48:55PM +0100, Alexander Klauer
alexander.kla...@itwm.fraunhofer.de wrote:
So, in essence, this means the current glibc realloc() violates the
C89 standard but is C99-conformant?
I think the problem was that the C89 wording was confusing, and the
way to proceed was
Hi,
On 02/21/2013 04:01 PM, Marc Lehmann wrote:
The C89 standard says (any typos are mine):
7.10.3.4 the realloc function
[...]
If size is zero and ptr is not a null pointer, the object it points to is
freed.
Your quote is from 7.10.3, and only applies if an allocation is
Hi,
On 02/20/2013 06:16 PM, Marc Lehmann wrote:
On Wed, Feb 20, 2013 at 05:28:57PM +0100, Alexander Klauer
alexander.kla...@itwm.fraunhofer.de wrote:
semantics as a call to free(ptr). A C89-conformant implementation may
return a unique non-NULL pointer which may be safely passed to
free().
D'oh, will I ever get it right? Find the correct version of libev.c
attached.
Best regards,
Alexander
#includeassert.h
#includeev.h
#includestdlib.h
static void * allocator( void * ptr, long size ) {
assert( ( size = 0 ) ( ( unsigned long ) size = ( size_t ) -1 ) );
return realloc( ptr,
On Thu, Feb 21, 2013 at 10:39:20AM +0100, Alexander Klauer
alexander.kla...@itwm.fraunhofer.de wrote:
1. if size is equal to zero, and ptr is
not NULL, then the call is equivalent to free(ptr).
The last assertion is incorrect. See 4. for a proof on concept in
libev below.
That assertion was
Hi,
let's see if I get it right this time. libev maps allocation,
reallocation, and freeing of memory to calls of one single function, set
by ev_set_allocator(), or the default ev_realloc_emul(). The libev API
specification mandates that the allocator function fulfils the
requirements of
On Wed, Feb 20, 2013 at 05:28:57PM +0100, Alexander Klauer
alexander.kla...@itwm.fraunhofer.de wrote:
semantics as a call to free(ptr). A C89-conformant implementation may
return a unique non-NULL pointer which may be safely passed to
free().
And when does this happen *in libev*? realloc