pdf-devel
[Top][All Lists]
Advanced

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

[pdf-devel] Re: Doubt about pdf_alloc


From: Luca Braglia
Subject: [pdf-devel] Re: Doubt about pdf_alloc
Date: Wed, 30 Dec 2009 11:53:37 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On 29/12/09 -  15:31, Luca Braglia wrote:
> might it be
> 
>   if (pointer && size == 0)

or 
  if (pointer && !size){...} 


>     {
>       pointer = NULL;
>     }
> 
> so that pdf_alloc handles this exception (if one ask for 0 heap
> bytes) unlike classic malloc (that returns a pointer)?

at least on my Debian...

a rationale could be to uniform return value from malloc(0)
across platforms

(from current draft standard - 7.20.3):

If the size of the space requested is zero, the behavior is
implementation- defined: either a null pointer is returned, or
the behavior is as if the size were some nonzero value, except
that the returned pointer shall not be used to access an object.

if i missed something, please let me know

bye




reply via email to

[Prev in Thread] Current Thread [Next in Thread]