diff options
author | Xinchen Hui <laruence@php.net> | 2014-08-13 15:51:43 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2014-08-13 15:51:43 +0800 |
commit | da3aeeed39f24e34e9318d7123ff84f0c5a98e61 (patch) | |
tree | 422cc176cbd624f5c4dcd78e66e3403b095ec7b8 /ext/mysql/php_mysql.c | |
parent | 05eaed43453bf74144bc6115db641e9e8a41d568 (diff) | |
download | php-git-da3aeeed39f24e34e9318d7123ff84f0c5a98e61.tar.gz |
clean up - avoid realloc
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r-- | ext/mysql/php_mysql.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 6518f8d36a..30cac98b65 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -1310,11 +1310,13 @@ PHP_FUNCTION(mysql_stat) { php_mysql_conn *mysql; zval *mysql_link = NULL; +#ifndef MYSQL_USE_MYSQLND char *stat; -#ifdef MYSQL_USE_MYSQLND - uint stat_len; +#else + zend_string *stat; #endif + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) { return; } @@ -1332,10 +1334,8 @@ PHP_FUNCTION(mysql_stat) if ((stat = (char *)mysql_stat(mysql->conn))) { RETURN_STRING(stat); #else - if (mysqlnd_stat(mysql->conn, &stat, &stat_len) == PASS) { - // TODO: avoid reallocation ??? - RETVAL_STRINGL(stat, stat_len); - efree(stat); + if (mysqlnd_stat(mysql->conn, &stat) == PASS) { + RETURN_STR(stat); #endif } else { RETURN_FALSE; |