summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-06-16 04:09:20 +0000
committerGreg Beaver <cellog@php.net>2008-06-16 04:09:20 +0000
commit4e65a5814684cee6bb909387834f3530abe1cc65 (patch)
treeea320ba08114123402c098e41bbc0b0708464c39 /ext
parent03b9673ba2cc1d4af980f790a560fbb8291b17c0 (diff)
downloadphp-git-4e65a5814684cee6bb909387834f3530abe1cc65.tar.gz
fix hashtable creation for tar to be estimated size needed
Diffstat (limited to 'ext')
-rw-r--r--ext/phar/tar.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 618ff76997..92ecde46af 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -216,11 +216,12 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
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 */