dmitry                                   Tue, 06 Jul 2010 16:09:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=301027

Log:
zend_stack initialization is delayed before the actual usage

Changed paths:
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/Zend/zend_stack.c

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS      2010-07-06 15:52:39 UTC (rev 301026)
+++ php/php-src/trunk/NEWS      2010-07-06 16:09:43 UTC (rev 301027)
@@ -18,6 +18,7 @@
     A constant class name may be used as a direct operand of ZEND_FETCH_*
     instruction without previous ZEND_FETCH_CLASS.
   . eliminated unnecessary iterations during request startup/shutdown
+  . zend_stack initialization is delayed before the actual usage
 - Added concept of interned strings. All strings constants known at compile
   time are allocated in a single copy and never changed. (Dmitry)
 - Added an optimization which saves memory and emalloc/efree calls for empty

Modified: php/php-src/trunk/Zend/zend_stack.c
===================================================================
--- php/php-src/trunk/Zend/zend_stack.c 2010-07-06 15:52:39 UTC (rev 301026)
+++ php/php-src/trunk/Zend/zend_stack.c 2010-07-06 16:09:43 UTC (rev 301027)
@@ -25,13 +25,9 @@
 ZEND_API int zend_stack_init(zend_stack *stack)
 {
        stack->top = 0;
-       stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE);
-       if (!stack->elements) {
-               return FAILURE;
-       } else {
-               stack->max = STACK_BLOCK_SIZE;
-               return SUCCESS;
-       }
+       stack->max = 0;
+       stack->elements = NULL;
+       return SUCCESS;
 }

 ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to