cellog Mon Jun 16 04:10:53 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/phar phar.c phar.phar
Log:
remove unused variables in phar_fix_filepath
copy virtual_dirs to avoid segfault on multi-process
fix metadata reading for phar.cache_list
initialize manifest to exact size needed (performance increase)
fix freeing of signature on error to use the correct persist value (fixes
segfault on error in cache.list)
reset EG(regular_list) so it is identical to how we found it
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.c?r1=1.370.2.19&r2=1.370.2.20&diff_format=u
Index: php-src/ext/phar/phar.c
diff -u php-src/ext/phar/phar.c:1.370.2.19 php-src/ext/phar/phar.c:1.370.2.20
--- php-src/ext/phar/phar.c:1.370.2.19 Sun Jun 15 23:00:46 2008
+++ php-src/ext/phar/phar.c Mon Jun 16 04:10:53 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: phar.c,v 1.370.2.19 2008/06/15 23:00:46 cellog Exp $ */
+/* $Id: phar.c,v 1.370.2.20 2008/06/16 04:10:53 cellog Exp $ */
#define PHAR_MAIN 1
#include "phar_internal.h"
@@ -137,6 +137,7 @@
PHAR_GLOBALS->persist = 0;
PHAR_GLOBALS->manifest_cached = 0;
zend_destroy_rsrc_list(&EG(regular_list)
TSRMLS_CC);
+ memset(&EG(regular_list), 0, sizeof(HashTable));
efree(tmp);
zend_hash_destroy(&(PHAR_G(phar_fname_map)));
PHAR_GLOBALS->phar_fname_map.arBuckets = 0;
@@ -162,6 +163,7 @@
PHAR_GLOBALS->phar_alias_map.arBuckets = 0;
zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
+ memset(&EG(regular_list), 0, sizeof(HashTable));
efree(tmp);
}
/* }}} */
@@ -443,7 +445,7 @@
phar_destroy_phar_data(mydata TSRMLS_CC);\
}\
if (signature) {\
- pefree(signature, mydata->is_persistent);\
+ pefree(signature, PHAR_G(persist));\
}\
MAPPHAR_ALLOC_FAIL(msg)
@@ -962,11 +964,11 @@
}
/* set up our manifest */
- zend_hash_init(&mydata->manifest, sizeof(phar_entry_info),
+ zend_hash_init(&mydata->manifest, manifest_count,
zend_get_hash_value, destroy_phar_manifest_entry,
mydata->is_persistent);
- zend_hash_init(&mydata->mounted_dirs, sizeof(char *),
+ zend_hash_init(&mydata->mounted_dirs, 5,
zend_get_hash_value, NULL, mydata->is_persistent);
- zend_hash_init(&mydata->virtual_dirs, sizeof(char *),
+ zend_hash_init(&mydata->virtual_dirs, manifest_count * 2,
zend_get_hash_value, NULL, mydata->is_persistent);
offset = halt_offset + manifest_len + 4;
memset(&entry, 0, sizeof(phar_entry_info));
@@ -1013,8 +1015,7 @@
entry.flags |= PHAR_ENT_PERM_DEF_DIR;
}
if (entry.is_persistent) {
- PHAR_GET_32(buffer, entry.metadata_len);
- if (phar_parse_metadata(&buffer, &entry.metadata,
entry.metadata_len TSRMLS_CC) == FAILURE) {
+ if (phar_parse_metadata(&buffer, &entry.metadata, 0
TSRMLS_CC) == FAILURE) {
pefree(entry.filename, entry.is_persistent);
MAPPHAR_FAIL("unable to read file metadata in
.phar file \"%s\"");
}
@@ -1896,9 +1897,9 @@
{
char newpath[MAXPATHLEN];
int newpath_len;
- char *ptr, *free_path, *new_phar;
+ char *ptr;
char *tok;
- int ptr_length, new_phar_len = 1, path_length = *new_len;
+ int ptr_length, path_length = *new_len;
if (PHAR_G(cwd_len) && use_cwd && path_length > 2 && path[0] == '.' &&
path[1] == '/') {
newpath_len = PHAR_G(cwd_len);
@@ -3332,6 +3333,9 @@
phar->manifest = newmanifest;
zend_hash_init(&phar->mounted_dirs, sizeof(char *),
zend_get_hash_value, NULL, 0);
+ zend_hash_init(&phar->virtual_dirs, sizeof(char *),
+ zend_get_hash_value, NULL, 0);
+ zend_hash_copy(&phar->virtual_dirs, &(*pphar)->virtual_dirs, NULL,
NULL, sizeof(void *));
*pphar = phar;
}
/* }}} */
@@ -3408,7 +3412,7 @@
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
- php_info_print_table_row(2, "CVS revision", "$Revision: 1.370.2.19 $");
+ php_info_print_table_row(2, "CVS revision", "$Revision: 1.370.2.20 $");
php_info_print_table_row(2, "Phar-based phar archives", "enabled");
php_info_print_table_row(2, "Tar-based phar archives", "enabled");
php_info_print_table_row(2, "ZIP-based phar archives", "enabled");
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar.phar?r1=1.7.2.18&r2=1.7.2.19&diff_format=u
Index: php-src/ext/phar/phar.phar
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php