summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 34a5d97495..263ab85cb2 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -208,7 +208,7 @@ PHP_FUNCTION(stream_socket_server)
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
if (context) {
- GC_REFCOUNT(context->res)++;
+ GC_ADDREF(context->res);
}
if (zerrno) {
@@ -665,8 +665,7 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds)
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
return 0;
}
- ZVAL_NEW_ARR(&new_array);
- zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
+ array_init_size(&new_array, zend_hash_num_elements(Z_ARRVAL_P(stream_array)));
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(stream_array), num_ind, key, elem) {
php_socket_t this_fd;
@@ -714,8 +713,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array)
if (Z_TYPE_P(stream_array) != IS_ARRAY) {
return 0;
}
- ZVAL_NEW_ARR(&new_array);
- zend_hash_init(Z_ARRVAL(new_array), zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);
+ array_init_size(&new_array, zend_hash_num_elements(Z_ARRVAL_P(stream_array)));
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(stream_array), elem) {
ZVAL_DEREF(elem);
@@ -1077,10 +1075,10 @@ PHP_FUNCTION(stream_context_get_params)
array_init(return_value);
if (context->notifier && Z_TYPE(context->notifier->ptr) != IS_UNDEF && context->notifier->func == user_space_stream_notifier) {
+ Z_TRY_ADDREF(context->notifier->ptr);
add_assoc_zval_ex(return_value, "notification", sizeof("notification")-1, &context->notifier->ptr);
- if (Z_REFCOUNTED(context->notifier->ptr)) Z_ADDREF(context->notifier->ptr);
}
- if (Z_REFCOUNTED(context->options)) Z_ADDREF(context->options);
+ Z_TRY_ADDREF(context->options);
add_assoc_zval_ex(return_value, "options", sizeof("options")-1, &context->options);
}
/* }}} */
@@ -1231,7 +1229,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
if (filter) {
filter->res = zend_register_resource(filter, php_file_le_stream_filter());
- GC_REFCOUNT(filter->res)++;
+ GC_ADDREF(filter->res);
RETURN_RES(filter->res);
} else {
RETURN_FALSE;
@@ -1559,7 +1557,7 @@ PHP_FUNCTION(stream_resolve_include_path)
Z_PARAM_PATH(filename, filename_len)
ZEND_PARSE_PARAMETERS_END();
- resolved_path = zend_resolve_path(filename, (int)filename_len);
+ resolved_path = zend_resolve_path(filename, filename_len);
if (resolved_path) {
RETURN_STR(resolved_path);