[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_

2010-04-06 Thread Andrey Hristov
andrey   Tue, 06 Apr 2010 13:28:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=297582

Log:
Recommit with an Windows build fix:
Fix inconsistencies
- memory allocated with spprintf, or likes, outside of mysqlnd's
allocator functions should not be freed by the mysqlnd's allocator
(a wrapper around emalloc/malloc).
- memory allocated by the mysqlnd's allocator should only be freed
  by it.
- add a mode to track memory usage (malloc/free)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-04-06 13:22:49 UTC (rev 297581)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-04-06 13:28:23 UTC (rev 297582)
@@ -529,6 +529,7 @@
 		db = ;
 		db_len = 0;
 	}
+
 	host_len = strlen(host);
 	{
 		char * transport = NULL;
@@ -553,7 +554,7 @@
 		DBG_INF_FMT(transport=%s, transport);
 		conn-scheme = mnd_pestrndup(transport, transport_len, conn-persistent);
 		conn-scheme_len = transport_len;
-		efree(transport);
+		efree(transport); /* allocated by spprintf */
 		transport = NULL;
 	}

@@ -643,6 +644,7 @@
 		}
 	} else {
 		CONN_SET_STATE(conn, CONN_READY);
+
 		if (!self_alloced  saved_compression) {
 			conn-net-compressed = TRUE;
 		}
@@ -662,16 +664,14 @@
 		conn-connect_or_select_db_len = db_len;

 		if (!unix_socket) {
-			char *p;

 			conn-host = mnd_pestrdup(host, conn-persistent);
 			conn-host_len = strlen(conn-host);
-			spprintf(p, 0, %s via TCP/IP, conn-host);
-			if (conn-persistent) {
-conn-host_info = mnd_pestrdup(p, 1);
-mnd_efree(p);
-			} else {
-conn-host_info = p;
+			{
+char *p;
+spprintf(p, 0, %s via TCP/IP, conn-host);
+conn-host_info =  mnd_pestrdup(p, conn-persistent);
+efree(p); /* allocated by spprintf */
 			}
 		} else {
 			conn-unix_socket	= mnd_pestrdup(socket, conn-persistent);
@@ -693,10 +693,6 @@
 		SET_EMPTY_ERROR(conn-error_info);

 		mysqlnd_local_infile_default(conn);
-		{
-			unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/
-			conn-m-set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *)buf_size TSRMLS_CC);
-		}

 		MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn-stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1);
 		if (reconnect) {
@@ -707,6 +703,7 @@
 		}

 		DBG_INF_FMT(connection_id=%llu, conn-thread_id);
+
 #if PHP_MAJOR_VERSION = 6
 		{
 			unsigned int as_unicode = 1;
@@ -715,7 +712,6 @@
 			DBG_INF(unicode set);
 		}
 #endif
-
 		if (conn-options.init_commands) {
 			int current_command = 0;
 			for (; current_command  conn-options.num_commands; ++current_command) {
@@ -773,7 +769,7 @@
 		 unsigned int mysql_flags
 		 TSRMLS_DC)
 {
-	enum_func_status ret;
+	enum_func_status ret = FAIL;
 	zend_bool self_alloced = FALSE;

 	DBG_ENTER(mysqlnd_connect);
@@ -1139,7 +1135,7 @@
 		result = conn-m-store_result(conn TSRMLS_CC);
 	}
 	if (show_query != query) {
-		mnd_efree(show_query);
+		efree(show_query); /* allocated by spprintf */
 	}
 	DBG_RETURN(result);
 }
@@ -1225,7 +1221,7 @@
 	SET_ERROR_AFF_ROWS(conn);
 	if (ret == PASS) {
 		if (conn-connect_or_select_db) {
-			pefree(conn-connect_or_select_db, conn-persistent);
+			mnd_pefree(conn-connect_or_select_db, conn-persistent);
 		}
 		conn-connect_or_select_db = mnd_pestrndup(db, db_len, conn-persistent);
 		conn-connect_or_select_db_len = db_len;
@@ -1275,10 +1271,9 @@
 	if (FAIL == (ret = PACKET_READ(stats_header, conn))) {
 		DBG_RETURN(FAIL);
 	}
-	*message = stats_header-message;
+	/* will be freed by Zend, thus don't use the mnd_ allocator */
+	*message = estrndup(stats_header-message, stats_header-message_len);
 	*message_len = stats_header-message_len;
-	/* Ownership transfer */
-	stats_header-message = NULL;
 	PACKET_FREE(stats_header);

 	DBG_INF(*message);
@@ -1343,7 +1338,7 @@
 	} else {
 		conn-charset = charset;
 	}
-	mnd_efree(query);
+	efree(query); /* allocated by spprintf */

 	DBG_INF(ret == PASS? PASS:FAIL);
 	DBG_RETURN(ret);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 13:22:49 UTC (rev 297581)
+++ 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/pdo_mysql/config.m4 trunk/ext/pdo_mysql/config.m4

2010-04-06 Thread Antony Dovgal
tony2001 Tue, 06 Apr 2010 13:42:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=297583

Log:
fix typo

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/pdo_mysql/config.m4
U   php/php-src/trunk/ext/pdo_mysql/config.m4

Modified: php/php-src/branches/PHP_5_3/ext/pdo_mysql/config.m4
===
--- php/php-src/branches/PHP_5_3/ext/pdo_mysql/config.m42010-04-06 
13:28:23 UTC (rev 297582)
+++ php/php-src/branches/PHP_5_3/ext/pdo_mysql/config.m42010-04-06 
13:42:21 UTC (rev 297583)
@@ -3,7 +3,7 @@
 dnl vim: se ts=2 sw=2 et:

 PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO,
-[  --with-pdo-mysql[=DIR]PDO: MySQL support. DIR is the MySQL base directoy
+[  --with-pdo-mysql[=DIR]PDO: MySQL support. DIR is the MySQL base 
directory
  If mysqlnd is passed as DIR, the MySQL native
  native driver will be used [/usr/local]])


Modified: php/php-src/trunk/ext/pdo_mysql/config.m4
===
--- php/php-src/trunk/ext/pdo_mysql/config.m4   2010-04-06 13:28:23 UTC (rev 
297582)
+++ php/php-src/trunk/ext/pdo_mysql/config.m4   2010-04-06 13:42:21 UTC (rev 
297583)
@@ -3,7 +3,7 @@
 dnl vim: se ts=2 sw=2 et:

 PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO,
-[  --with-pdo-mysql[=DIR]PDO: MySQL support. DIR is the MySQL base directoy
+[  --with-pdo-mysql[=DIR]PDO: MySQL support. DIR is the MySQL base 
directory
  If mysqlnd is passed as DIR, the MySQL native
  native driver will be used [/usr/local]])


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-04-06 Thread Andrey Hristov
andrey   Tue, 06 Apr 2010 14:33:55 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=297584

Log:
Stricly C

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-04-06 
13:42:21 UTC (rev 297583)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-04-06 
14:33:55 UTC (rev 297584)
@@ -696,9 +696,9 @@
DBG_INF_FMT(size=%lu ptr=%p persistent=%d, size, ret, persistent);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -741,9 +741,9 @@
DBG_INF_FMT(size=%lu ptr=%p, size, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -789,9 +789,9 @@
DBG_INF_FMT(new_ptr=%p, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = new_size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
+   *(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size);
}
DBG_RETURN(FAKE_PTR(ret));

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-04-06 13:42:21 UTC 
(rev 297583)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-04-06 14:33:55 UTC 
(rev 297584)
@@ -696,9 +696,9 @@
DBG_INF_FMT(size=%lu ptr=%p persistent=%d, size, ret, persistent);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -741,9 +741,9 @@
DBG_INF_FMT(size=%lu ptr=%p, size, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -789,9 +789,9 @@
DBG_INF_FMT(new_ptr=%p, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = new_size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
+   *(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size);
}
DBG_RETURN(FAKE_PTR(ret));

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-04-06 Thread Andrey Hristov
andrey   Tue, 06 Apr 2010 18:14:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=297586

Log:
Fix the Windows build (void* arithmetic) as well as --disable-zlib
build.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -757,7 +757,7 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics  ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics  ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_erealloc_name);
 	DBG_INF_FMT(file=%-15s line=%4d, strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT(ptr=%p old_size=%lu, new_size=%lu, ptr, old_size, new_size);
@@ -779,7 +779,7 @@
 {
 	void *ret;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-	size_t old_size = collect_memory_statistics  ptr? *(size_t *) (ptr - sizeof(size_t)) : 0;
+	size_t old_size = collect_memory_statistics  ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 	DBG_ENTER(mysqlnd_perealloc_name);
 	DBG_INF_FMT(file=%-15s line=%4d, strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);
 	DBG_INF_FMT(ptr=%p old_size=%lu new_size=%lu persist=%d, ptr, old_size, new_size, persistent);
@@ -810,8 +810,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT(ptr=%p size=%u, ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT(ptr=%p size=%u, ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		efree(REAL_PTR(ptr));
 	}
@@ -835,8 +835,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT(ptr=%p size=%u, ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT(ptr=%p size=%u, ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		pefree(REAL_PTR(ptr), persistent);
 	}
@@ -923,8 +923,8 @@

 	if (ptr) {
 		if (collect_memory_statistics) {
-			free_amount = *(size_t *)(ptr - sizeof(size_t));
-			DBG_INF_FMT(ptr=%p size=%u, ptr - sizeof(size_t), (unsigned int) free_amount);
+			free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
+			DBG_INF_FMT(ptr=%p size=%u, ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
 		}
 		free(REAL_PTR(ptr));
 	}
@@ -976,7 +976,7 @@
 {
 	char * ret;
 	smart_str tmp_str = {0, 0, 0};
-	char * p = ptr;
+	const char * p = ptr;
 	zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 	DBG_ENTER(mysqlnd_pestrdup_name);
 	DBG_INF_FMT(file=%-15s line=%4d, strrchr(__zend_filename, PHP_DIR_SEPARATOR) + 1, __zend_lineno);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2010-04-06 16:40:05 UTC (rev 297585)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2010-04-06 18:14:23 UTC (rev 297586)
@@ -448,6 +448,7 @@
 MYSQLND_METHOD(mysqlnd_net, decode)(zend_uchar * uncompressed_data, size_t uncompressed_data_len,
 	const zend_uchar * const compressed_data, size_t compressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = uncompressed_data_len;
 	DBG_ENTER(mysqlnd_net::decode);
@@ -458,6 +459,10 @@
 		DBG_INF_FMT(decompression NOT successful. error=%d Z_OK=%d Z_BUF_ERROR=%d Z_MEM_ERROR=%d, error, Z_OK, Z_BUF_ERROR, Z_MEM_ERROR);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER(mysqlnd_net::decode);
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */

@@ -467,6 +472,7 @@
 MYSQLND_METHOD(mysqlnd_net, encode)(zend_uchar * compress_buffer, size_t compress_buffer_len,
 	const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC)
 {
+#ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
 	uLongf tmp_complen = compress_buffer_len;
 	DBG_ENTER(mysqlnd_net::encode);
@@ -478,6 +484,10 @@
 		DBG_INF_FMT(compression successful. compressed size=%d, tmp_complen);
 	}
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
+#else
+	DBG_ENTER(mysqlnd_net::encode);
+	DBG_RETURN(FAIL);
+#endif
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

[PHP-CVS] svn: /SVNROOT/ global_avail

2010-04-06 Thread Philip Olson
philip   Wed, 07 Apr 2010 01:27:52 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=297599

Log:
- phpdoc/es karma for Julio Napuri Carlos (julionc)

Changed paths:
U   SVNROOT/global_avail

Modified: SVNROOT/global_avail
===
--- SVNROOT/global_avail2010-04-07 01:18:47 UTC (rev 297598)
+++ SVNROOT/global_avail2010-04-07 01:27:52 UTC (rev 297599)
@@ -73,7 +73,7 @@
 avail|mkoula|phpdoc/cs
 avail|penguin,tkxs|phpdoc/da
 avail|kore,thorstenr,lapistano|phpdoc/de
-avail|mgonzalezle,ianasa,gustavo,soywiz,ladderalice,ideados,fcaroberga,dulasoft,benjamin,argosback,tatai,jesusruiz,jpberdejo,lduran,sabathorn|phpdoc/es
+avail|mgonzalezle,ianasa,gustavo,soywiz,ladderalice,ideados,fcaroberga,dulasoft,benjamin,argosback,tatai,jesusruiz,jpberdejo,lduran,sabathorn,julionc|phpdoc/es
 avail|parstic|phpdoc/fa
 avail|magidev,mikaelkael,jpauli|phpdoc/fr
 avail|xdanger,jiania,haohappy|phpdoc/zh,phpdoc/hk,phpdoc/tw

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