andrey          Thu Jun 11 08:30:08 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/mysqlnd        mysqlnd.h mysqlnd_palloc.c 
                                mysqlnd_wireprotocol.c php_mysqlnd.c 
  Log:
  Sync with PHP6 - TSRMLS_FETCH
  Extract reference decrement in own function
  Remove PHPAPI of a function and make it static as it is not called
  externally
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.h?r1=1.3.2.23&r2=1.3.2.24&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd.h
diff -u php-src/ext/mysqlnd/mysqlnd.h:1.3.2.23 
php-src/ext/mysqlnd/mysqlnd.h:1.3.2.24
--- php-src/ext/mysqlnd/mysqlnd.h:1.3.2.23      Thu May 28 11:47:48 2009
+++ php-src/ext/mysqlnd/mysqlnd.h       Thu Jun 11 08:30:08 2009
@@ -18,12 +18,12 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: mysqlnd.h,v 1.3.2.23 2009/05/28 11:47:48 andrey Exp $ */
+/* $Id: mysqlnd.h,v 1.3.2.24 2009/06/11 08:30:08 andrey Exp $ */
 
 #ifndef MYSQLND_H
 #define MYSQLND_H
 
-#define MYSQLND_VERSION "mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.23 $"
+#define MYSQLND_VERSION "mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.24 $"
 #define MYSQLND_VERSION_ID 50005
 
 /* This forces inlining of some accessor functions */
@@ -318,11 +318,9 @@
 PHPAPI void                                             
_mysqlnd_palloc_rshutdown(MYSQLND_THD_ZVAL_PCACHE * cache TSRMLS_DC);
 
 
-#define mysqlnd_palloc_init_thd_cache(cache)                   
_mysqlnd_palloc_init_thd_cache((cache) TSRMLS_CC)
 #define mysqlnd_palloc_free_thd_cache_reference(cache) 
_mysqlnd_palloc_free_thd_cache_reference((cache) TSRMLS_CC)
 #define mysqlnd_palloc_get_thd_cache_reference(cache)  
_mysqlnd_palloc_get_thd_cache_reference((cache) TSRMLS_CC)
 
-PHPAPI MYSQLND_THD_ZVAL_PCACHE*        
_mysqlnd_palloc_init_thd_cache(MYSQLND_ZVAL_PCACHE * const cache TSRMLS_DC);
 MYSQLND_THD_ZVAL_PCACHE*               
_mysqlnd_palloc_get_thd_cache_reference(MYSQLND_THD_ZVAL_PCACHE * const cache 
TSRMLS_DC);
 PHPAPI void                                            
_mysqlnd_palloc_free_thd_cache_reference(MYSQLND_THD_ZVAL_PCACHE **cache 
TSRMLS_DC);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_palloc.c?r1=1.2.2.17&r2=1.2.2.18&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_palloc.c
diff -u php-src/ext/mysqlnd/mysqlnd_palloc.c:1.2.2.17 
php-src/ext/mysqlnd/mysqlnd_palloc.c:1.2.2.18
--- php-src/ext/mysqlnd/mysqlnd_palloc.c:1.2.2.17       Mon Jun  8 10:20:27 2009
+++ php-src/ext/mysqlnd/mysqlnd_palloc.c        Thu Jun 11 08:30:08 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: mysqlnd_palloc.c,v 1.2.2.17 2009/06/08 10:20:27 andrey Exp $ */
+/* $Id: mysqlnd_palloc.c,v 1.2.2.18 2009/06/11 08:30:08 andrey Exp $ */
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_priv.h"
@@ -82,6 +82,7 @@
 
 
 /* {{{ mysqlnd_palloc_get_cache_reference */
+static inline
 MYSQLND_ZVAL_PCACHE* mysqlnd_palloc_get_cache_reference(MYSQLND_ZVAL_PCACHE * 
const cache)
 {
        if (cache) {
@@ -94,6 +95,20 @@
 /* }}} */
 
 
+/* {{{ mysqlnd_palloc_release_cache_reference */
+static inline
+MYSQLND_ZVAL_PCACHE* 
mysqlnd_palloc_release_cache_reference(MYSQLND_ZVAL_PCACHE * const cache)
+{
+       if (cache) {
+               LOCK_PCACHE(cache);
+               cache->references--;
+               UNLOCK_PCACHE(cache);
+       }
+       return cache;
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_palloc_free_cache */
 /*
   As this call will happen on MSHUTDOWN(), then we don't need to copy the 
zvals with
@@ -122,7 +137,7 @@
 
 
 /* {{{ _mysqlnd_palloc_init_thd_cache */
-PHPAPI MYSQLND_THD_ZVAL_PCACHE* 
_mysqlnd_palloc_init_thd_cache(MYSQLND_ZVAL_PCACHE * const cache TSRMLS_DC)
+MYSQLND_THD_ZVAL_PCACHE* mysqlnd_palloc_init_thd_cache(MYSQLND_ZVAL_PCACHE * 
const cache TSRMLS_DC)
 {
        MYSQLND_THD_ZVAL_PCACHE *ret = calloc(1, 
sizeof(MYSQLND_THD_ZVAL_PCACHE));
        DBG_ENTER("_mysqlnd_palloc_init_thd_cache");
@@ -163,17 +178,18 @@
 {
        DBG_ENTER("_mysqlnd_palloc_get_thd_cache_reference");
        if (cache) {
-               ++cache->references;
                DBG_INF_FMT("cache=%p new_refc=%d gc_list.canary1=%p 
gc_list.canary2=%p",
                                        cache, cache->references, 
cache->gc_list.canary1, cache->gc_list.canary2);
                mysqlnd_palloc_get_cache_reference(cache->parent);
+               /* No concurrency here, we are in the same thread */
+               ++cache->references;
        }
        DBG_RETURN(cache);
 }
 /* }}} */
 
 
-/* {{{ mysqlnd_palloc_free_cache */
+/* {{{ mysqlnd_palloc_free_thd_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
@@ -230,7 +246,7 @@
 {
        DBG_ENTER("_mysqlnd_palloc_free_thd_cache_reference");
        if (*cache) {
-               --(*cache)->parent->references;
+               mysqlnd_palloc_release_cache_reference((*cache)->parent);
                DBG_INF_FMT("cache=%p references_left=%d canary1=%p canary2=%p",
                                        *cache, (*cache)->references, 
(*cache)->gc_list.canary1, (*cache)->gc_list.canary2);
 
@@ -528,7 +544,7 @@
 /* {{{ _mysqlnd_palloc_rinit */
 PHPAPI MYSQLND_THD_ZVAL_PCACHE * _mysqlnd_palloc_rinit(MYSQLND_ZVAL_PCACHE * 
cache TSRMLS_DC)
 {
-       return mysqlnd_palloc_init_thd_cache(cache);
+       return mysqlnd_palloc_init_thd_cache(cache TSRMLS_CC);
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_wireprotocol.c?r1=1.4.2.25&r2=1.4.2.26&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_wireprotocol.c
diff -u php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.4.2.25 
php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.4.2.26
--- php-src/ext/mysqlnd/mysqlnd_wireprotocol.c:1.4.2.25 Mon Jun  8 10:20:27 2009
+++ php-src/ext/mysqlnd/mysqlnd_wireprotocol.c  Thu Jun 11 08:30:08 2009
@@ -42,7 +42,6 @@
 #define MYSQLND_DUMP_HEADER_N_BODY2
 #define MYSQLND_DUMP_HEADER_N_BODY_FULL2
 
-
 #define        PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_size, 
packet_type_as_text, packet_type) \
        { \
                if (FAIL == mysqlnd_read_header((conn), &((packet)->header) 
TSRMLS_CC)) {\
@@ -1364,7 +1363,7 @@
        zval **current_field, **end_field, **start_field;
        zend_bool as_unicode = conn->options.numeric_and_datetime_as_unicode;
        zend_bool allocated;
-       void *obj;
+       void *obj = NULL;
 
        DBG_ENTER("php_mysqlnd_rowp_read_binary_protocol");
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/php_mysqlnd.c?r1=1.1.2.9&r2=1.1.2.10&diff_format=u
Index: php-src/ext/mysqlnd/php_mysqlnd.c
diff -u php-src/ext/mysqlnd/php_mysqlnd.c:1.1.2.9 
php-src/ext/mysqlnd/php_mysqlnd.c:1.1.2.10
--- php-src/ext/mysqlnd/php_mysqlnd.c:1.1.2.9   Mon Mar 30 16:52:33 2009
+++ php-src/ext/mysqlnd/php_mysqlnd.c   Thu Jun 11 08:30:08 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_mysqlnd.c,v 1.1.2.9 2009/03/30 16:52:33 felipe Exp $ */
+/* $Id: php_mysqlnd.c,v 1.1.2.10 2009/06/11 08:30:08 andrey Exp $ */
 #include "php.h"
 #include "php_ini.h"
 #include "mysqlnd.h"
@@ -46,13 +46,13 @@
 
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values);
        while (zend_hash_get_current_data_ex(Z_ARRVAL_P(values),
-                                                                               
(void **)&values_entry, &pos_values) == SUCCESS) {
-               TSRMLS_FETCH();
+               (void **)&values_entry, &pos_values) == SUCCESS) {
                zstr    string_key;
                uint    string_key_len;
                ulong   num_key;
                int     s_len;
                char    *s = NULL;
+               TSRMLS_FETCH();
 
                zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, 
&string_key_len, &num_key, 0, &pos_values);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to