andrey                                   Thu, 07 Oct 2010 13:49:00 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=304183

Log:
fix some uninitialized variables. also fix shadowing of global symbols

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_loaddata.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.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-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -1593,14 +1593,14 @@
 		case IS_OBJECT: {
 			char *class_name;
 			zend_uint class_name_len;
-			int dup;
+			int dupl;

 			TRACE_APPEND_STR("Object(");

-			dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
+			dupl = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);

 			TRACE_APPEND_STRL(class_name, class_name_len);
-			if(!dup) {
+			if (!dupl) {
 				efree(class_name);
 			}


Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -173,7 +173,7 @@
 enum_func_status
 mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_warning TSRMLS_DC)
 {
-	char				*buf;
+	char				*buf = NULL;
 	char				empty_packet[MYSQLND_HEADER_SIZE];
 	enum_func_status	result = FAIL;
 	unsigned int		buflen = 4096;
@@ -244,7 +244,9 @@
 	}

 	(*conn->infile.local_infile_end)(info TSRMLS_CC);
-	mnd_efree(buf);
+	if (buf) {
+		mnd_efree(buf);
+	}
 	DBG_INF_FMT("%s", result == PASS? "PASS":"FAIL");
 	DBG_RETURN(result);
 }

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -2125,7 +2125,7 @@
 	MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
 	MYSQLND * conn;
 	zend_uchar cmd_buf[STMT_ID_LENGTH /* statement id */];
-	enum_mysqlnd_collected_stats stat = STAT_LAST;
+	enum_mysqlnd_collected_stats statistic = STAT_LAST;

 	DBG_ENTER("mysqlnd_stmt::net_close");
 	if (!stmt || !stmt->conn) {
@@ -2176,16 +2176,16 @@
 	}
 	switch (stmt->execute_count) {
 		case 0:
-			stat = STAT_PS_PREPARED_NEVER_EXECUTED;
+			statistic = STAT_PS_PREPARED_NEVER_EXECUTED;
 			break;
 		case 1:
-			stat = STAT_PS_PREPARED_ONCE_USED;
+			statistic = STAT_PS_PREPARED_ONCE_USED;
 			break;
 		default:
 			break;
 	}
-	if (stat != STAT_LAST) {
-		MYSQLND_INC_CONN_STATISTIC(conn->stats, stat);
+	if (statistic != STAT_LAST) {
+		MYSQLND_INC_CONN_STATISTIC(conn->stats, statistic);
 	}

 	if (stmt->execute_cmd_buffer.buffer) {
@@ -2209,7 +2209,7 @@
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit TSRMLS_DC)
 {
 	MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
-	enum_func_status ret;
+	enum_func_status ret = FAIL;
 	zend_bool persistent = s->persistent;

 	DBG_ENTER("mysqlnd_stmt::dtor");

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -459,7 +459,7 @@
 				break;
 			default: do {			/* Result set */
 				MYSQLND_RES * result;
-				enum_mysqlnd_collected_stats stat = STAT_LAST;
+				enum_mysqlnd_collected_stats statistic = STAT_LAST;

 				DBG_INF("Result set pending");
 				SET_EMPTY_MESSAGE(conn->last_message, conn->last_message_len, conn->persistent);
@@ -548,11 +548,11 @@
 					*/
 					conn->upsert_status.server_status = fields_eof->server_status;
 					if (fields_eof->server_status & SERVER_QUERY_NO_GOOD_INDEX_USED) {
-						stat = STAT_BAD_INDEX_USED;
+						statistic = STAT_BAD_INDEX_USED;
 					} else if (fields_eof->server_status & SERVER_QUERY_NO_INDEX_USED) {
-						stat = STAT_NO_INDEX_USED;
+						statistic = STAT_NO_INDEX_USED;
 					} else if (fields_eof->server_status & SERVER_QUERY_WAS_SLOW) {
-						stat = STAT_QUERY_WAS_SLOW;
+						statistic = STAT_QUERY_WAS_SLOW;
 					}
 					if (to_log) {
 #if A0
@@ -561,7 +561,7 @@
 						efree(backtrace);
 #endif
 					}
-					MYSQLND_INC_CONN_STATISTIC(conn->stats, stat);
+					MYSQLND_INC_CONN_STATISTIC(conn->stats, statistic);
 				}
 			} while (0);
 			PACKET_FREE(fields_eof);
@@ -1613,7 +1613,7 @@
 	}

 	/* 4 is a magic value. The cast is safe, if larger then the array will be later extended - no big deal :) */
-	mysqlnd_array_init(return_value, (unsigned int) set? (uint) set->row_count : 4);
+	mysqlnd_array_init(return_value, set? (unsigned int) set->row_count : 4);

 	do {
 		MAKE_STD_ZVAL(row);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -274,14 +274,14 @@

 /* {{{ mysqlnd_stats_set_trigger */
 PHPAPI mysqlnd_stat_trigger
-mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC)
+mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats statistic, mysqlnd_stat_trigger trigger TSRMLS_DC)
 {
 	mysqlnd_stat_trigger ret = NULL;
 	DBG_ENTER("mysqlnd_stats_set_trigger");
 	if (stats) {
 		MYSQLND_STATS_LOCK(stats);
-		ret = stats->triggers[stat];
-		stats->triggers[stat] = trigger;
+		ret = stats->triggers[statistic];
+		stats->triggers[statistic] = trigger;
 		MYSQLND_STATS_UNLOCK(stats);
 	}
 	DBG_RETURN(ret);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -1593,14 +1593,14 @@
 		case IS_OBJECT: {
 			char *class_name;
 			zend_uint class_name_len;
-			int dup;
+			int dupl;

 			TRACE_APPEND_STR("Object(");

-			dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
+			dupl = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);

 			TRACE_APPEND_STRL(class_name, class_name_len);
-			if(!dup) {
+			if (!dupl) {
 				efree(class_name);
 			}


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -173,7 +173,7 @@
 enum_func_status
 mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_warning TSRMLS_DC)
 {
-	char				*buf;
+	char				*buf = NULL;
 	char				empty_packet[MYSQLND_HEADER_SIZE];
 	enum_func_status	result = FAIL;
 	unsigned int		buflen = 4096;
@@ -244,7 +244,9 @@
 	}

 	(*conn->infile.local_infile_end)(info TSRMLS_CC);
-	mnd_efree(buf);
+	if (buf) {
+		mnd_efree(buf);
+	}
 	DBG_INF_FMT("%s", result == PASS? "PASS":"FAIL");
 	DBG_RETURN(result);
 }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -2125,7 +2125,7 @@
 	MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
 	MYSQLND * conn;
 	zend_uchar cmd_buf[STMT_ID_LENGTH /* statement id */];
-	enum_mysqlnd_collected_stats stat = STAT_LAST;
+	enum_mysqlnd_collected_stats statistic = STAT_LAST;

 	DBG_ENTER("mysqlnd_stmt::net_close");
 	if (!stmt || !stmt->conn) {
@@ -2176,16 +2176,16 @@
 	}
 	switch (stmt->execute_count) {
 		case 0:
-			stat = STAT_PS_PREPARED_NEVER_EXECUTED;
+			statistic = STAT_PS_PREPARED_NEVER_EXECUTED;
 			break;
 		case 1:
-			stat = STAT_PS_PREPARED_ONCE_USED;
+			statistic = STAT_PS_PREPARED_ONCE_USED;
 			break;
 		default:
 			break;
 	}
-	if (stat != STAT_LAST) {
-		MYSQLND_INC_CONN_STATISTIC(conn->stats, stat);
+	if (statistic != STAT_LAST) {
+		MYSQLND_INC_CONN_STATISTIC(conn->stats, statistic);
 	}

 	if (stmt->execute_cmd_buffer.buffer) {
@@ -2209,7 +2209,7 @@
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit TSRMLS_DC)
 {
 	MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
-	enum_func_status ret;
+	enum_func_status ret = FAIL;
 	zend_bool persistent = s->persistent;

 	DBG_ENTER("mysqlnd_stmt::dtor");

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -459,7 +459,7 @@
 				break;
 			default: do {			/* Result set */
 				MYSQLND_RES * result;
-				enum_mysqlnd_collected_stats stat = STAT_LAST;
+				enum_mysqlnd_collected_stats statistic = STAT_LAST;

 				DBG_INF("Result set pending");
 				SET_EMPTY_MESSAGE(conn->last_message, conn->last_message_len, conn->persistent);
@@ -548,11 +548,11 @@
 					*/
 					conn->upsert_status.server_status = fields_eof->server_status;
 					if (fields_eof->server_status & SERVER_QUERY_NO_GOOD_INDEX_USED) {
-						stat = STAT_BAD_INDEX_USED;
+						statistic = STAT_BAD_INDEX_USED;
 					} else if (fields_eof->server_status & SERVER_QUERY_NO_INDEX_USED) {
-						stat = STAT_NO_INDEX_USED;
+						statistic = STAT_NO_INDEX_USED;
 					} else if (fields_eof->server_status & SERVER_QUERY_WAS_SLOW) {
-						stat = STAT_QUERY_WAS_SLOW;
+						statistic = STAT_QUERY_WAS_SLOW;
 					}
 					if (to_log) {
 #if A0
@@ -561,7 +561,7 @@
 						efree(backtrace);
 #endif
 					}
-					MYSQLND_INC_CONN_STATISTIC(conn->stats, stat);
+					MYSQLND_INC_CONN_STATISTIC(conn->stats, statistic);
 				}
 			} while (0);
 			PACKET_FREE(fields_eof);
@@ -1610,7 +1610,7 @@
 	}

 	/* 4 is a magic value. The cast is safe, if larger then the array will be later extended - no big deal :) */
-	mysqlnd_array_init(return_value, (unsigned int) set? (uint) set->row_count : 4);
+	mysqlnd_array_init(return_value, set? (unsigned int) set->row_count : 4);

 	do {
 		MAKE_STD_ZVAL(row);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c	2010-10-07 13:25:01 UTC (rev 304182)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c	2010-10-07 13:49:00 UTC (rev 304183)
@@ -274,14 +274,14 @@

 /* {{{ mysqlnd_stats_set_trigger */
 PHPAPI mysqlnd_stat_trigger
-mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC)
+mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats statistic, mysqlnd_stat_trigger trigger TSRMLS_DC)
 {
 	mysqlnd_stat_trigger ret = NULL;
 	DBG_ENTER("mysqlnd_stats_set_trigger");
 	if (stats) {
 		MYSQLND_STATS_LOCK(stats);
-		ret = stats->triggers[stat];
-		stats->triggers[stat] = trigger;
+		ret = stats->triggers[statistic];
+		stats->triggers[statistic] = trigger;
 		MYSQLND_STATS_UNLOCK(stats);
 	}
 	DBG_RETURN(ret);
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to