}
/* }}}*/
+/**
+ * Delete refcount and destruct if needed. On destruct return 1 else 0.
+ */
+int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
+{
+ if (--phar->refcount < 0) {
+ if (zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) {
+ phar_destroy_phar_data(phar TSRMLS_CC);
+ }
+ return 1;
+ }
+ return 0;
+}
+/* }}}*/
+
/**
* Destroy phar's in shutdown, here we don't care about aliases
*/
/* data->fp is the temporary memory stream containing this file's data */
phar_free_entry_data(data TSRMLS_CC);
- if (--phar->refcount < 0) {
- if (zend_hash_del(&(PHAR_GLOBALS->phar_fname_map), phar->fname, phar->fname_len) != SUCCESS) {
- phar_destroy_phar_data(phar TSRMLS_CC);
- }
- }
+ phar_archive_delref(phar TSRMLS_CC);
return 0;
}
#endif
+int phar_archive_delref(phar_archive_data *phar TSRMLS_DC);
void phar_destroy_phar_data(phar_archive_data *data TSRMLS_DC);
phar_entry_info *phar_get_entry_info(phar_archive_data *phar, char *path, int path_len TSRMLS_DC);
void phar_free_entry_data(phar_entry_data *idata TSRMLS_DC);
*/
static void phar_spl_foreign_dtor(spl_filesystem_object *object TSRMLS_DC) /* {{{ */
{
- phar_archive_data *phar_data = (phar_archive_data *) object->oth;
-
- if (--phar_data->refcount < 0) {
- phar_destroy_phar_data(phar_data TSRMLS_CC);
- }
+ phar_archive_delref((phar_archive_data *) object->oth TSRMLS_CC);
+ object->oth = NULL;
}
/* }}} */