summaryrefslogtreecommitdiff
path: root/ext/recode
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-07-03 12:38:53 +0000
committerFelipe Pena <felipe@php.net>2008-07-03 12:38:53 +0000
commit6488a8554548cdea8bb2eecb3804a5525e0167a5 (patch)
tree7af0dd878a22e2a03ca436c06627329a713c124e /ext/recode
parentbd075724948e68b7799eba21766aafe3e8e895c6 (diff)
downloadphp-git-6488a8554548cdea8bb2eecb3804a5525e0167a5.tar.gz
- New parameter parsing API
Diffstat (limited to 'ext/recode')
-rw-r--r--ext/recode/recode.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index 79fb5cb300..20542038da 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -188,17 +188,18 @@ error_exit:
PHP_FUNCTION(recode_file)
{
RECODE_REQUEST request = NULL;
- zval **req;
- zval **input, **output;
+ char *req;
+ int req_len;
+ zval *input, *output;
php_stream *instream, *outstream;
FILE *in_fp, *out_fp;
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &req, &input, &output) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srr", &req, &req_len, &input, &output) == FAILURE) {
+ return;
}
- php_stream_from_zval(instream, input);
- php_stream_from_zval(outstream, output);
+ php_stream_from_zval(instream, &input);
+ php_stream_from_zval(outstream, &output);
if (FAILURE == php_stream_cast(instream, PHP_STREAM_AS_STDIO, (void**)&in_fp, REPORT_ERRORS)) {
RETURN_FALSE;
@@ -207,8 +208,6 @@ PHP_FUNCTION(recode_file)
if (FAILURE == php_stream_cast(outstream, PHP_STREAM_AS_STDIO, (void**)&out_fp, REPORT_ERRORS)) {
RETURN_FALSE;
}
-
- convert_to_string_ex(req);
request = recode_new_request(ReSG(outer));
if (request == NULL) {
@@ -216,8 +215,8 @@ PHP_FUNCTION(recode_file)
RETURN_FALSE;
}
- if (!recode_scan_request(request, Z_STRVAL_PP(req))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", Z_STRVAL_PP(req));
+ if (!recode_scan_request(request, req)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal recode request '%s'", req);
goto error_exit;
}