mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: minor loop optimizations, closes #2633
This commit is contained in:
commit
8d5a5fbf6b
3 changed files with 14 additions and 7 deletions
|
@ -1210,7 +1210,7 @@ PHP_FUNCTION(mysqli_fetch_fields)
|
|||
zval *mysql_result;
|
||||
zval obj;
|
||||
|
||||
unsigned int i;
|
||||
unsigned int i, num_fields;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
|
||||
return;
|
||||
|
@ -1219,8 +1219,9 @@ PHP_FUNCTION(mysqli_fetch_fields)
|
|||
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
|
||||
|
||||
array_init(return_value);
|
||||
num_fields = mysql_num_fields(result);
|
||||
|
||||
for (i = 0; i < mysql_num_fields(result); i++) {
|
||||
for (i = 0; i < num_fields; i++) {
|
||||
const MYSQL_FIELD *field = mysql_fetch_field_direct(result, i);
|
||||
|
||||
object_init(&obj);
|
||||
|
@ -1266,7 +1267,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
|
|||
{
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
unsigned int i;
|
||||
unsigned int i, num_fields;
|
||||
#if defined(MYSQLI_USE_MYSQLND)
|
||||
const size_t *ret;
|
||||
#else
|
||||
|
@ -1284,8 +1285,9 @@ PHP_FUNCTION(mysqli_fetch_lengths)
|
|||
}
|
||||
|
||||
array_init(return_value);
|
||||
num_fields = mysql_num_fields(result);
|
||||
|
||||
for (i = 0; i < mysql_num_fields(result); i++) {
|
||||
for (i = 0; i < num_fields; i++) {
|
||||
add_index_long(return_value, i, ret[i]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue