Merge branch 'PHP-7.1' into PHP-7.2

* PHP-7.1:
  minor loop optimizations, closes #2633
This commit is contained in:
Joe Watkins 2017-07-25 06:54:20 +01:00
commit 8d5a5fbf6b
No known key found for this signature in database
GPG Key ID: F9BA0ADA31CBD89E
3 changed files with 14 additions and 7 deletions

View File

@ -1152,7 +1152,7 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
{
#if !defined(MYSQLI_USE_MYSQLND)
MYSQL_ROW row;
unsigned int i;
unsigned int i, num_fields;
MYSQL_FIELD *fields;
zend_ulong *field_len;
@ -1166,8 +1166,9 @@ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend
array_init(return_value);
field_len = mysql_fetch_lengths(result);
num_fields = mysql_num_fields(result);
for (i = 0; i < mysql_num_fields(result); i++) {
for (i = 0; i < num_fields; i++) {
if (row[i]) {
zval res;

View File

@ -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]);
}
}

View File

@ -677,8 +677,12 @@ static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
size_t i;
if (xheaders) {
size_t headers_lc_len;
headers_lc = estrdup(xheaders);
for (i = 0; i < strlen(headers_lc); i++) {
headers_lc_len = strlen(headers_lc);
for (i = 0; i < headers_lc_len; i++) {
headers_lc[i] = tolower(headers_lc[i]);
}
}