Skip to content

Commit d8e4d7c

Browse files
committed
Use zend_new_pair() as suggested by Niels
1 parent a4017d4 commit d8e4d7c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ext/standard/streamsfuncs.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ PHP_FUNCTION(sapi_windows_console_size)
17811781
php_stream *stream;
17821782
zend_long fileno;
17831783
int width, height;
1784-
zval ztmp;
1784+
zval zwidth, zheight;
17851785

17861786
ZEND_PARSE_PARAMETERS_START(1, 1)
17871787
Z_PARAM_RESOURCE(zsrc)
@@ -1810,11 +1810,9 @@ PHP_FUNCTION(sapi_windows_console_size)
18101810
RETURN_FALSE;
18111811
}
18121812

1813-
array_init(return_value);
1814-
ZVAL_LONG(&ztmp, width);
1815-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &ztmp);
1816-
ZVAL_LONG(&ztmp, height);
1817-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &ztmp);
1813+
ZVAL_LONG(&zwidth, width);
1814+
ZVAL_LONG(&zheight, height);
1815+
RETURN_ARR(zend_new_pair(&zwidth, &zheight));
18181816
}
18191817
#endif
18201818

0 commit comments

Comments
 (0)