Re[3]: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_default_classes.c zend_default_classes.h
| From: | (Marcus B�rger) | Date: | Sat, 30 Aug 2003 23:25:38 +0000 |
| Subject: | Re[3]: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_default_classes.c zend_default_classes.h | ||
| References: | 1 2 3 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-1757@lists.php.net to get a copy of this message | ||
Hello Andi,
Saturday, August 30, 2003, 9:33:08 PM, you wrote:
AG> At 09:18 PM 8/30/2003 +0200, Marcus Börger wrote:
>>Hello Andi,
>>
>>Saturday, August 30, 2003, 9:01:26 PM, you wrote:
>>
>>AG> Marcus,
>>
>>AG> You shouldn't use malloc()/free() if possible during execution. I suggest
>>AG> you either use emalloc()/efree() or if you want to allocate on the stack
>>AG> then use do_alloca()/free_alloca().
>>
>>The real problem here is that we don't detect C99 compliant snprintf in Zend
>>and can't move spprintf into Zend engine. So i did the best compromise
>>available.
AG> Isn't always using the vsnprintf() an option even when it's _GNU_SOURCE?
AG> It's maybe not optimal because you have to use an arbitrary limit but it's
AG> OK for now.
AG> I can't remember if the versions in PHP's source tree use emalloc() or not.
AG> If they do we could possibly use it.
I have designed spprintf from PHP exactly for the reason of using emalloc
otherwise i would have written a saprintf wrapper. But we can't use PHP code
inside the engine.
Then using vsnprintf is not an option because the return value isn't portable
(as far as i know). And we'd need to use vsnprintf with length 0 first to
calculate the length. The workaround is what George did in reflection_api.c
but that was supposed only a temporary solution.
But i agree. We could use a better solution...
--
Best regards,
Marcus mailto:helly@php.net