davidc          Tue Jun 24 22:53:01 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       formatted_print.c 
  Log:
  - New parsing parameter API
  - Tests have been adjusted, if you have something else failing
    let me know now! All tests seem to pass fine at the moment.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.82.2.1.2.16.2.3&r2=1.82.2.1.2.16.2.4&diff_format=u
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.3 
php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.4
--- php-src/ext/standard/formatted_print.c:1.82.2.1.2.16.2.3    Mon Mar 17 
23:06:32 2008
+++ php-src/ext/standard/formatted_print.c      Tue Jun 24 22:53:01 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.3 2008/03/17 23:06:32 stas Exp $ */
+/* $Id: formatted_print.c,v 1.82.2.1.2.16.2.4 2008/06/24 22:53:01 davidc Exp $ 
*/
 
 #include <math.h>                              /* modf() */
 #include "php.h"
@@ -373,26 +373,22 @@
 static char *
 php_formatted_print(int ht, int *len, int use_array, int format_offset 
TSRMLS_DC)
 {
-       zval ***args, **z_format;
+       zval ***args = NULL, **z_format;
        int argc, size = 240, inpos = 0, outpos = 0, temppos;
        int alignment, currarg, adjusting, argnum, width, precision;
        char *format, *result, padding;
        int always_sign;
 
-       argc = ZEND_NUM_ARGS();
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) 
== FAILURE) {
+               return;
+       }
 
        /* verify the number of args */
        if ((use_array && argc != (2 + format_offset)) 
                        || (!use_array && argc < (1 + format_offset))) {
                WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
        }
-       args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0);
 
-       if (zend_get_parameters_array_ex(argc, args) == FAILURE) {
-               efree(args);
-               WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
-       }
-       
        if (use_array) {
                int i = 1;
                zval ***newargs;
@@ -690,6 +686,7 @@
        if ((result=php_formatted_print(ht, &len, 1, 0 TSRMLS_CC))==NULL) {
                RETURN_FALSE;
        }
+
        RETVAL_STRINGL(result, len, 0);
 }
 /* }}} */
@@ -731,18 +728,17 @@
 PHP_FUNCTION(fprintf)
 {
        php_stream *stream;
-       zval **arg1;
+       zval **arg1 = NULL;
+       zval **args = NULL;
+       int num_args;
        char *result;
+       zval **format;
        int len;
-       
-       if (ZEND_NUM_ARGS() < 2) {
-               WRONG_PARAM_COUNT;
-       }
-       
-       if (zend_get_parameters_ex(1, &arg1)==FAILURE) {
-               RETURN_FALSE;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z+", &arg1, 
&args) == FAILURE) {
+               return;
        }
-       
+
        php_stream_from_zval(stream, arg1);
 
        if ((result=php_formatted_print(ht, &len, 0, 1 TSRMLS_CC))==NULL) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to