Commit:    bbcea230e1b3c48cfe0097fca84f4bd9f0dfa31f
Author:    Xinchen Hui <larue...@php.net>         Mon, 21 May 2012 18:58:19 
+0800
Parents:   fbb86bd7b3c7425a64bb2f76532f937b3a050ea1
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=bbcea230e1b3c48cfe0097fca84f4bd9f0dfa31f

Log:
Use emalloc instead of malloc

Changed paths:
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index b7e7cd3..28f9824 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4077,14 +4077,14 @@ static void 
zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
        size_t i;
 
        /* prepare copies of trait function tables for combination */
-       function_tables = malloc(sizeof(HashTable*) * ce->num_traits);
-       resulting_table = (HashTable *) malloc(sizeof(HashTable));
+       function_tables = emalloc(sizeof(HashTable*) * ce->num_traits);
+       resulting_table = (HashTable *)emalloc(sizeof(HashTable));
        
        /* TODO: revisit this start size, may be its not optimal */
-       zend_hash_init_ex(resulting_table, 10, NULL, NULL, 1, 0);
+       zend_hash_init_ex(resulting_table, 10, NULL, NULL, 0, 0);
   
        for (i = 0; i < ce->num_traits; i++) {
-               function_tables[i] = (HashTable *) malloc(sizeof(HashTable));
+               function_tables[i] = (HashTable *)emalloc(sizeof(HashTable));
                zend_hash_init_ex(function_tables[i], 
ce->traits[i]->function_table.nNumOfElements, NULL, NULL, 1, 0);
 
                if (ce->trait_precedences) {
@@ -4117,14 +4117,14 @@ static void 
zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
        for (i = 0; i < ce->num_traits; i++) {
                /* zend_hash_destroy(function_tables[i]); */
                zend_hash_graceful_destroy(function_tables[i]);
-               free(function_tables[i]);
+               efree(function_tables[i]);
        }
-       free(function_tables);
+       efree(function_tables);
 
        /* free temporary resulting table */
        /* zend_hash_destroy(resulting_table); */
        zend_hash_graceful_destroy(resulting_table);
-       free(resulting_table);
+       efree(resulting_table);
 }
 /* }}} */


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

Reply via email to