Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
| From: | Sterling Hughes | Date: | Mon, 19 Jul 2004 17:38:11 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-2775@lists.php.net to get a copy of this message | ||
sure. what i mean is that you can write code that does malloc(0), and
then generally at some point realloc's that area and it will work
reliably. This code follows that code path by not using the blocks.
Its not really the if() check's that bother me from a perf
perspective, i just think it makes the code more complex than it
should be.
-sterling
On Mon, 19 Jul 2004 19:23:35 +0200, Stefan Esser <sesser@php.net> wrote:
> Sterling Hughes wrote:
>
> > I agree... malloc(0) is a valid construct, which is why i was kinda
> > surprised. ateotd (*), this should be fixed in the leak reporter...
>
> malloc(0) is a valid construct with undefined behaviour. The C99
> standard says that malloc(0) may either return a NULL pointer OR an
> empty area.
>
> But if I see the code correctly we are calling emalloc() and not
> malloc() (or did I see something wrong). emalloc() always adds a header
> to allocated area, so it never calls malloc(0).
>
> Stefan
>
>