cvs: php-src(PHP_5_1) /ext/oci8 oci8.c
| From: | Antony Dovgal | Date: | Wed, 18 Jan 2006 10:12:34 +0000 |
| Subject: | cvs: php-src(PHP_5_1) /ext/oci8 oci8.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36563@lists.php.net to get a copy of this message | ||
tony2001 Wed Jan 18 10:12:34 2006 UTC
Modified files: (Branch: PHP_5_1)
/php-src/ext/oci8 oci8.c
Log:
MFH: reorganize resource destruction
http://cvs.php.net/viewcvs.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.9&r2=1.269.2.10&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.9 php-src/ext/oci8/oci8.c:1.269.2.10
--- php-src/ext/oci8/oci8.c:1.269.2.9 Tue Jan 17 23:44:51 2006
+++ php-src/ext/oci8/oci8.c Wed Jan 18 10:12:34 2006
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.269.2.9 2006/01/17 23:44:51 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.10 2006/01/18 10:12:34 tony2001 Exp $ */
/* TODO
*
* file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() with
OCI_ATTR_LOBEMPTY
@@ -89,8 +89,7 @@
static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC);
#ifdef ZTS
-static int php_oci_statement_helper(zend_rsrc_list_entry *le TSRMLS_DC);
-static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC);
+static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC);
#endif
static int php_oci_connection_ping(php_oci_connection * TSRMLS_DC);
static int php_oci_connection_status(php_oci_connection * TSRMLS_DC);
@@ -624,14 +623,16 @@
PHP_RSHUTDOWN_FUNCTION(oci)
{
#ifdef ZTS
- zend_hash_apply(&EG(regular_list), (apply_func_t) php_oci_statement_helper TSRMLS_CC);
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void
*)le_descriptor TSRMLS_CC);
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void
*)le_collection TSRMLS_CC);
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void
*)le_statement TSRMLS_CC);
#endif
/* check persistent connections and do the necessary actions if needed */
zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC);
#ifdef ZTS
- zend_hash_apply(&EG(regular_list), (apply_func_t) php_oci_regular_helper TSRMLS_CC);
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void
*)le_connection TSRMLS_CC);
php_oci_cleanup_global_handles(TSRMLS_C);
#endif
@@ -644,7 +645,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.9 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.10 $");
sprintf(buf, "%ld", OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1736,30 +1737,14 @@
} /* }}} */
#ifdef ZTS
-/* {{{ php_oci_regular_helper()
- Helper function to close non-persistent connections at the end of request in ZTS mode */
-static int php_oci_regular_helper(zend_rsrc_list_entry *le TSRMLS_DC)
+/* {{{ php_oci_list_helper()
+ Helper function to destroy data on thread shutdown in ZTS mode */
+static int php_oci_list_helper(zend_rsrc_list_entry *le, void *le_type TSRMLS_DC)
{
- php_oci_connection *connection;
-
- if (le->type == le_connection) {
- connection = (php_oci_connection *)le->ptr;
- if (connection) {
- return 1;
- }
- }
- return 0;
-} /* }}} */
-
-/* {{{ php_oci_statement_helper()
- Helper function to destroy statements on thread shutdown in ZTS mode */
-static int php_oci_statement_helper(zend_rsrc_list_entry *le TSRMLS_DC)
-{
- php_oci_statement *statement;
-
- if (le->type == le_statement) {
- statement = (php_oci_statement *)le->ptr;
- if (statement) {
+ int type = (int) le_type;
+
+ if (le->type == type) {
+ if (le->ptr != NULL) {
return 1;
}
}