diff options
author | Xinchen Hui <laruence@gmail.com> | 2014-02-24 18:12:30 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2014-02-24 18:12:30 +0800 |
commit | 5adeaa147d273e9adcde44c7dbc06b44a9f1d845 (patch) | |
tree | 9d395bca256985b090387b33e21503bebadfc583 /ext/standard/streamsfuncs.c | |
parent | 9e9f6c7123599a022a9acfeb52d0ad2152200827 (diff) | |
download | php-git-5adeaa147d273e9adcde44c7dbc06b44a9f1d845.tar.gz |
Refactoring php_stream_copy_to_mem to return zend_string
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r-- | ext/standard/streamsfuncs.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index b5608f450d..32f24c4df0 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -412,8 +412,7 @@ PHP_FUNCTION(stream_get_contents) zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, desiredpos = -1L; - int len; - char *contents = NULL; + zend_string *contents; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zsrc, &maxlen, &desiredpos) == FAILURE) { RETURN_FALSE; @@ -441,14 +440,9 @@ PHP_FUNCTION(stream_get_contents) } } - len = php_stream_copy_to_mem(stream, &contents, maxlen, 0); + contents = php_stream_copy_to_mem(stream, maxlen, 0); - if (contents) { -//??? RETVAL_STRINGL(contents, len, 0); - RETVAL_STRINGL(contents, len); - } else { - RETVAL_EMPTY_STRING(); - } + RETURN_STR(contents); } /* }}} */ |