summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2009-06-08 10:20:27 +0000
committerAndrey Hristov <andrey@php.net>2009-06-08 10:20:27 +0000
commitec777b89f48ac998ebc3516290cf2f2e043d92e8 (patch)
tree07bb77137d0cda8c2894cd82cb0f2eacc7e13359 /ext
parent4cb1d57fd5ff231e24896d4b4a24a69c6cdc15d9 (diff)
downloadphp-git-ec777b89f48ac998ebc3516290cf2f2e043d92e8.tar.gz
Merge with HEAD. Someone committed changes to HEAD and did not merge back to
the branch. Also switch off the zval cache, for now.
Diffstat (limited to 'ext')
-rw-r--r--ext/mysqlnd/mysqlnd_palloc.c67
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c9
2 files changed, 39 insertions, 37 deletions
diff --git a/ext/mysqlnd/mysqlnd_palloc.c b/ext/mysqlnd/mysqlnd_palloc.c
index 117b889a48..1b035ed365 100644
--- a/ext/mysqlnd/mysqlnd_palloc.c
+++ b/ext/mysqlnd/mysqlnd_palloc.c
@@ -549,48 +549,45 @@ PHPAPI void mysqlnd_palloc_stats(const MYSQLND_ZVAL_PCACHE * const cache, zval *
{
if (cache) {
#if PHP_MAJOR_VERSION >= 6
+ UChar *ustr;
+ int ulen;
+
TSRMLS_FETCH();
#endif
LOCK_PCACHE(cache);
array_init(return_value);
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
-
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "put_hits", sizeof("put_hits") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "put_misses", sizeof("put_misses") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "get_hits", sizeof("get_hits") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "get_misses", sizeof("get_misses") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "size", sizeof("size") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "free_items", sizeof("free_items") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "references", sizeof("references") TSRMLS_CC);
- add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
- efree(ustr);
- } else
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "put_hits", sizeof("put_hits") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "put_misses", sizeof("put_misses") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "get_hits", sizeof("get_hits") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "get_misses", sizeof("get_misses") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "size", sizeof("size") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "free_items", sizeof("free_items") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, "references", sizeof("references") TSRMLS_CC);
+ add_u_assoc_long_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, cache->put_hits);
+ efree(ustr);
+#else
+ add_assoc_long_ex(return_value, "put_hits", sizeof("put_hits"), cache->put_hits);
+ add_assoc_long_ex(return_value, "put_misses", sizeof("put_misses"), cache->put_misses);
+ add_assoc_long_ex(return_value, "get_hits", sizeof("get_hits"), cache->get_hits);
+ add_assoc_long_ex(return_value, "get_misses", sizeof("get_misses"), cache->get_misses);
+ add_assoc_long_ex(return_value, "size", sizeof("size"), cache->max_items);
+ add_assoc_long_ex(return_value, "free_items", sizeof("free_items"), cache->free_items);
+ add_assoc_long_ex(return_value, "references", sizeof("references"), cache->references);
#endif
- {
- add_assoc_long_ex(return_value, "put_hits", sizeof("put_hits"), cache->put_hits);
- add_assoc_long_ex(return_value, "put_misses", sizeof("put_misses"), cache->put_misses);
- add_assoc_long_ex(return_value, "get_hits", sizeof("get_hits"), cache->get_hits);
- add_assoc_long_ex(return_value, "get_misses", sizeof("get_misses"), cache->get_misses);
- add_assoc_long_ex(return_value, "size", sizeof("size"), cache->max_items);
- add_assoc_long_ex(return_value, "free_items", sizeof("free_items"), cache->free_items);
- add_assoc_long_ex(return_value, "references", sizeof("references"), cache->references);
- }
UNLOCK_PCACHE(cache);
} else {
ZVAL_NULL(return_value);
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 0d928ce336..2924827e9c 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1378,7 +1378,7 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
bit = 4; /* first 2 bits are reserved */
for (i = 0; current_field < end_field; current_field++, i++) {
-#if 1
+#ifdef USE_ZVAL_CACHE
DBG_INF("Trying to use the zval cache");
obj = mysqlnd_palloc_get_zval(conn->zval_cache, &allocated TSRMLS_CC);
if (allocated) {
@@ -1474,11 +1474,12 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
for (i = 0; current_field < end_field; current_field++, i++) {
/* Don't reverse the order. It is significant!*/
void *obj;
- zend_bool allocated;
+ zend_bool allocated = TRUE;
zend_uchar *this_field_len_pos = p;
/* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */
unsigned long len = php_mysqlnd_net_field_length(&p);
+#ifdef USE_ZVAL_CACHE
obj = mysqlnd_palloc_get_zval(conn->zval_cache, &allocated TSRMLS_CC);
if (allocated) {
*current_field = (zval *) obj;
@@ -1487,6 +1488,10 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
*current_field = &((mysqlnd_zval *) obj)->zv;
((mysqlnd_zval *) obj)->point_type = MYSQLND_POINTS_FREE;
}
+#else
+ DBG_INF("Directly creating zval");
+ MAKE_STD_ZVAL(*current_field);
+#endif
if (current_field > start_field && last_field_was_string) {
/*