]> granicus.if.org Git - php/commitdiff
cleanup sscanf() just a tiny bit, just so it looks like the rest of the code
authorSterling Hughes <sterling@php.net>
Mon, 3 Sep 2001 04:49:36 +0000 (04:49 +0000)
committerSterling Hughes <sterling@php.net>
Mon, 3 Sep 2001 04:49:36 +0000 (04:49 +0000)
in the string.c file.

ext/standard/string.c

index 058ab85dfa735f8d3c7061bc5ee616bba56523d3..968dc5532619d7fba300b176d9cb49a5dbd4f2d2 100644 (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;       
-
-    argCount = ZEND_NUM_ARGS();
-       if (argCount < 2) {
+    zval ***args;
+    int     result;
+       int         argc = ZEND_NUM_ARGS();     
+
+       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;
        }
-
 }
 /* }}} */