diff options
author | Sterling Hughes <sterling@php.net> | 2002-11-27 20:05:20 +0000 |
---|---|---|
committer | Sterling Hughes <sterling@php.net> | 2002-11-27 20:05:20 +0000 |
commit | 5c96f91123ef0ccb5236ec2d23dcbc881f89a5c8 (patch) | |
tree | fad8551ce3224244597d47a60871e24765b0dc0f | |
parent | 7abdf90a0eee9436a11e21c6880b0251c39b3280 (diff) | |
download | php-git-5c96f91123ef0ccb5236ec2d23dcbc881f89a5c8.tar.gz |
don't use stupid constants, be smart, just read the line
-rw-r--r-- | ext/standard/file.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index e08c3c0ee3..a1c923d332 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1484,27 +1484,23 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - len = SCAN_MAX_FSCANF_BUFSIZE; - buf = emalloc(len + 1); - /* needed because recv doesnt put a null at the end*/ - memset(buf, 0, len+1); - - if (php_stream_gets((php_stream *) what, buf, len) == NULL) { - efree(buf); + buf = php_stream_get_line((php_stream *) what, NULL, 0, &len); + if (buf == NULL) { RETURN_FALSE; } convert_to_string_ex(format_string); result = php_sscanf_internal(buf, Z_STRVAL_PP(format_string), argCount, args, 2, &return_value TSRMLS_CC); + efree(args); efree(buf); + if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - WRONG_PARAM_COUNT + WRONG_PARAM_COUNT; } - } /* }}} */ |