1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 01:23:53 +02:00

cleanup sscanf() just a tiny bit, just so it looks like the rest of the code

in the string.c file.
This commit is contained in:
Sterling Hughes
2001-09-03 04:49:36 +00:00
parent e46decaa32
commit f14ada19ac

View File

@@ -3724,38 +3724,32 @@ PHP_FUNCTION(str_pad)
Implements an ANSI C compatible sscanf */
PHP_FUNCTION(sscanf)
{
zval **format;
zval **literal;
int result;
zval ***args;
int argCount;
zval ***args;
int result;
int argc = ZEND_NUM_ARGS();
argCount = ZEND_NUM_ARGS();
if (argCount < 2) {
if (argc < 2) {
WRONG_PARAM_COUNT;
}
args = (zval ***)emalloc(argCount * sizeof(zval **));
if (!args || (zend_get_parameters_array_ex(argCount, args) == FAILURE)) {
efree( args );
args = (zval ***) emalloc(argc * sizeof(zval **));
if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
literal = args[0];
format = args[1];
convert_to_string_ex( format );
convert_to_string_ex( literal );
convert_to_string_ex(args[0]);
convert_to_string_ex(args[1]);
result = php_sscanf_internal( (*literal)->value.str.val,
(*format)->value.str.val,
argCount, args,
2, &return_value TSRMLS_CC);
result = php_sscanf_internal(Z_STRVAL_PP(args[0]),
Z_STRVAL_PP(args[1]),
argc, args,
2, &return_value TSRMLS_CC);
efree(args);
if (SCAN_ERROR_WRONG_PARAM_COUNT == result) {
WRONG_PARAM_COUNT;
}
}
/* }}} */