]> granicus.if.org Git - php/commitdiff
- Fix shutdown issue (keep the speed)
authorMarcus Boerger <helly@php.net>
Wed, 10 Jan 2007 00:38:17 +0000 (00:38 +0000)
committerMarcus Boerger <helly@php.net>
Wed, 10 Jan 2007 00:38:17 +0000 (00:38 +0000)
ext/phar/phar.c

index 24b346247458bd056485603c717a8d2d52914110..d7b3376c4bb168d225f732c34bede8df419a933a 100644 (file)
@@ -230,6 +230,23 @@ static void phar_destroy_phar_data(phar_archive_data *data TSRMLS_DC) /* {{{ */
 }
 /* }}}*/
 
+/**
+ * Destroy phar's in shutdown, here we don't care about aliases
+ */
+static void destroy_phar_data_only(void *pDest) /* {{{ */
+{
+       phar_archive_data *phar_data = *(phar_archive_data **) pDest;
+       TSRMLS_FETCH();
+
+       if (--phar_data->refcount < 0) {
+               phar_destroy_phar_data(phar_data TSRMLS_CC);
+       }
+}
+/* }}}*/
+
+/**
+ * Delete aliases to phar's that got kicked out of the global table
+ */
 static int phar_unalias_apply(void *pDest, void *argument TSRMLS_DC) /* {{{ */
 {
        return *(void**)pDest == argument ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_KEEP;
@@ -3003,6 +3020,7 @@ PHP_RINIT_FUNCTION(phar) /* {{{ */
 PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
 {
        zend_hash_destroy(&(PHAR_GLOBALS->phar_alias_map));
+       PHAR_GLOBALS->phar_fname_map. pDestructor = destroy_phar_data_only;
        zend_hash_destroy(&(PHAR_GLOBALS->phar_fname_map));
        return SUCCESS;
 }