cellog          Mon Jun 16 04:09:20 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   tar.c 
  Log:
  fix hashtable creation for tar to be estimated size needed
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tar.c?r1=1.55.2.9&r2=1.55.2.10&diff_format=u
Index: php-src/ext/phar/tar.c
diff -u php-src/ext/phar/tar.c:1.55.2.9 php-src/ext/phar/tar.c:1.55.2.10
--- php-src/ext/phar/tar.c:1.55.2.9     Sun Jun 15 21:42:20 2008
+++ php-src/ext/phar/tar.c      Mon Jun 16 04:09:20 2008
@@ -216,11 +216,12 @@
 
        myphar = (phar_archive_data *) pecalloc(1, sizeof(phar_archive_data), 
PHAR_G(persist));
        myphar->is_persistent = PHAR_G(persist);
-       zend_hash_init(&myphar->manifest, sizeof(phar_entry_info),
+       /* estimate number of entries, can't be certain with tar files */
+       zend_hash_init(&myphar->manifest, 2 + (totalsize >> 12),
                zend_get_hash_value, destroy_phar_manifest_entry, 
myphar->is_persistent);
-       zend_hash_init(&myphar->mounted_dirs, sizeof(char *),
+       zend_hash_init(&myphar->mounted_dirs, 5,
                zend_get_hash_value, NULL, myphar->is_persistent);
-       zend_hash_init(&myphar->virtual_dirs, sizeof(char *),
+       zend_hash_init(&myphar->virtual_dirs, 4 + (totalsize >> 11),
                zend_get_hash_value, NULL, myphar->is_persistent);
        myphar->is_tar = 1;
        /* remember whether this entire phar was compressed with gz/bzip2 */



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

Reply via email to