From: Andrey Hristov Date: Wed, 9 Dec 2009 20:38:11 +0000 (+0000) Subject: Remove stub code which never actually was used for anything. X-Git-Tag: php-5.3.2RC1~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06a417b6a95787283789acba55be65158d9d6a5a;p=php Remove stub code which never actually was used for anything. Things like this can be built on top of the core. --- diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 3f2a1554dc..1d351ef863 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -125,9 +125,6 @@ typedef struct _php_mysql_conn { int multi_query; } php_mysql_conn; -#ifdef MYSQL_USE_MYSQLND -static MYSQLND_QCACHE *mysql_mysqlnd_qcache; -#endif #if MYSQL_VERSION_ID >= 40101 #define MYSQL_DISABLE_MQ if (mysql->multi_query) { \ @@ -457,8 +454,6 @@ ZEND_MODULE_STARTUP_D(mysql) return FAILURE; } #endif -#else - mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif return SUCCESS; @@ -484,8 +479,6 @@ PHP_MSHUTDOWN_FUNCTION(mysql) mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysql_mysqlnd_qcache); #endif UNREGISTER_INI_ENTRIES(); diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h index b4bc4d042c..d1f7519ad0 100644 --- a/ext/mysql/php_mysql_structs.h +++ b/ext/mysql/php_mysql_structs.h @@ -124,9 +124,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mysql) long result_allocated; long trace_mode; long allow_local_infile; -#ifdef MYSQL_USE_MYSQLND - MYSQLND_QCACHE *mysqlnd_qcache; -#endif ZEND_END_MODULE_GLOBALS(mysql) #ifdef ZTS diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 4c9c6bf41d..31b8efece9 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -73,10 +73,6 @@ zend_class_entry *mysqli_driver_class_entry; zend_class_entry *mysqli_warning_class_entry; zend_class_entry *mysqli_exception_class_entry; -#ifdef MYSQLI_USE_MYSQLND -MYSQLND_QCACHE *mysqli_mysqlnd_qcache; -#endif - typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC); typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval TSRMLS_DC); @@ -633,8 +629,6 @@ PHP_MINIT_FUNCTION(mysqli) return FAILURE; } #endif -#else - mysqli_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -872,8 +866,6 @@ PHP_MSHUTDOWN_FUNCTION(mysqli) mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysqli_mysqlnd_qcache); #endif zend_hash_destroy(&mysqli_driver_properties); diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index e9d76b0289..c3bbfe7a11 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -196,10 +196,6 @@ extern zend_property_info mysqli_stmt_property_info_entries[]; extern zend_property_info mysqli_driver_property_info_entries[]; extern zend_property_info mysqli_warning_property_info_entries[]; -#ifdef MYSQLI_USE_MYSQLND -extern MYSQLND_QCACHE *mysqli_mysqlnd_qcache; -#endif - extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flag, int into_object); extern void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC); extern void php_clear_mysql(MY_MYSQL *); diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32 index a26d357fb6..c2185fd9e9 100644 --- a/ext/mysqlnd/config.w32 +++ b/ext/mysqlnd/config.w32 @@ -13,7 +13,6 @@ if (PHP_MYSQLND != "no") { "mysqlnd_loaddata.c " + "mysqlnd_ps.c " + "mysqlnd_ps_codec.c " + - "mysqlnd_qcache.c " + "mysqlnd_result.c " + "mysqlnd_result_meta.c " + "mysqlnd_statistics.c " + diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 884800dce3..a5cae22d1b 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -16,7 +16,7 @@ dnl If some extension uses mysqlnd it will get compiled in PHP core if test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_sources="mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ mysqlnd_ps.c mysqlnd_loaddata.c \ - mysqlnd_ps_codec.c mysqlnd_statistics.c mysqlnd_qcache.c\ + mysqlnd_ps_codec.c mysqlnd_statistics.c \ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\ mysqlnd_block_alloc.c php_mysqlnd.c" diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 46c0f30713..653a128e35 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -211,11 +211,6 @@ MYSQLND_METHOD(mysqlnd_conn, free_contents)(MYSQLND *conn TSRMLS_DC) mnd_pefree(conn->last_message, pers); conn->last_message = NULL; } - if (conn->qcache) { - DBG_INF("Freeing qcache reference"); - mysqlnd_qcache_free_cache_reference(&conn->qcache); - conn->qcache = NULL; - } if (conn->net.cmd_buffer.buffer) { DBG_INF("Freeing cmd buffer"); mnd_pefree(conn->net.cmd_buffer.buffer, pers); diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 033de59634..674d64b15e 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -306,34 +306,6 @@ PHPAPI ulong mysqlnd_old_escape_string(char *newstr, const char *escapestr, size /* Performance statistics */ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); - -/* ---------------------- QUERY CACHE ---------------*/ -struct st_mysqlnd_qcache { - HashTable *ht; - unsigned int references; -#ifdef ZTS - MUTEX_T LOCK_access; -#endif -}; - - -typedef struct st_mysqlnd_qcache_element { - MYSQLND_RES_BUFFERED *data; - MYSQLND_RES_METADATA *meta; - const char * query; - size_t query_len; -} MYSQLND_QCACHE_ELEMENT; - - -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache(); -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache); -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache); -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value); -MYSQLND_RES * mysqlnd_qcache_get(MYSQLND_QCACHE * const cache, const char * query, - size_t query_len); -void mysqlnd_qcache_put(MYSQLND_QCACHE * const cache, char * query, size_t query_len, - MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta); - /* double check the class name to avoid naming conflicts when using these: */ #define MYSQLND_METHOD(class, method) php_##class##_##method##_pub #define MYSQLND_METHOD_PRIVATE(class, method) php_##class##_##method##_priv diff --git a/ext/mysqlnd/mysqlnd_qcache.c b/ext/mysqlnd/mysqlnd_qcache.c deleted file mode 100644 index eef543ee48..0000000000 --- a/ext/mysqlnd/mysqlnd_qcache.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 6 | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2009 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Georg Richter | - | Andrey Hristov | - | Ulf Wendel | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ -#include "php.h" -#include "mysqlnd.h" -#include "mysqlnd_priv.h" -#include "mysqlnd_statistics.h" - -#define MYSQLND_SILENT - -#ifdef ZTS -#define LOCK_QCACHE(cache) tsrm_mutex_lock((cache)->LOCK_access) -#define UNLOCK_QCACHE(cache) tsrm_mutex_unlock((cache)->LOCK_access) -#else -#define LOCK_QCACHE(cache) -#define UNLOCK_QCACHE(cache) -#endif - - -/* {{{ mysqlnd_qcache_init_cache */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache() -{ - MYSQLND_QCACHE *cache = calloc(1, sizeof(MYSQLND_QCACHE)); -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_init_cache %p]\n", cache); -#endif - - cache->references = 1; -#ifdef ZTS - cache->LOCK_access = tsrm_mutex_alloc(); -#endif - cache->ht = malloc(sizeof(HashTable)); - zend_hash_init(cache->ht, 10 /* init_elements */, NULL, NULL, TRUE /*pers*/); - - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_get_cache_reference */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache) -{ - if (cache) { -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_get_cache_reference %p will become %d]\n", cache, cache->references+1); -#endif - LOCK_QCACHE(cache); - cache->references++; - UNLOCK_QCACHE(cache); - } - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache */ -/* - As this call will happen on MSHUTDOWN(), then we don't need to copy the zvals with - copy_ctor but scrap what they point to with zval_dtor() and then just free our - pre-allocated block. Precondition is that we ZVAL_NULL() the zvals when we put them - to the free list after usage. We ZVAL_NULL() them when we allocate them in the - constructor of the cache. -*/ -static -void mysqlnd_qcache_free_cache(MYSQLND_QCACHE *cache) -{ -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache %p]\n", cache); -#endif - -#ifdef ZTS - tsrm_mutex_free(cache->LOCK_access); -#endif - zend_hash_destroy(cache->ht); - free(cache->ht); - free(cache); -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache) -{ - if (*cache) { - zend_bool to_free; -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache_reference %p] refs=%d\n", *cache, (*cache)->references); -#endif - LOCK_QCACHE(*cache); - to_free = --(*cache)->references == 0; - /* Unlock before destroying */ - UNLOCK_QCACHE(*cache); - if (to_free) { - mysqlnd_qcache_free_cache(*cache); - } - *cache = NULL; - } -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value) -{ - if (cache) { - LOCK_QCACHE(cache); - array_init(return_value); - add_assoc_long_ex(return_value, "references", sizeof("references"), cache->references); - UNLOCK_QCACHE(cache); - } else { - ZVAL_NULL(return_value); - } -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index ab09530292..0fc0663e0b 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -223,9 +223,6 @@ MYSQLND_METHOD(mysqlnd_res, free_buffered_data)(MYSQLND_RES *result TSRMLS_DC) } set->data_cursor = NULL; set->row_count = 0; - if (set->qcache) { - mysqlnd_qcache_free_cache_reference(&set->qcache); - } DBG_INF("Freeing set"); mnd_pefree(set, set->persistent); @@ -1069,7 +1066,6 @@ MYSQLND_METHOD(mysqlnd_res, store_result_fetch_data)(MYSQLND * const conn, MYSQL set->row_buffers = mnd_pemalloc(free_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *), to_cache); } set->persistent = to_cache; - set->qcache = to_cache? mysqlnd_qcache_get_cache_reference(conn->qcache):NULL; set->references = 1; result->m.row_decoder = binary_protocol? php_mysqlnd_rowp_read_binary_protocol: diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 04e8ee078c..9409f0308a 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -107,9 +107,6 @@ typedef struct st_mysqlnd_error_info } mysqlnd_error_info; -typedef struct st_mysqlnd_qcache MYSQLND_QCACHE; - - typedef struct st_mysqlnd_infile_info { php_stream *fd; @@ -480,9 +477,6 @@ struct st_mysqlnd_connection /* options */ MYSQLND_OPTION options; - /* qcache */ - MYSQLND_QCACHE *qcache; - /* stats */ MYSQLND_STATS stats; @@ -526,7 +520,6 @@ struct st_mysqlnd_buffered_result uint64_t initialized_rows; zend_bool persistent; - MYSQLND_QCACHE *qcache; unsigned int references; mysqlnd_error_info error_info;