iliaa           Fri Jan 16 00:07:25 2009 UTC

  Modified files:              
    /php-src/ext/readline       readline.c 
  Log:
  MFB: Improved parameter handling
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.61&r2=1.62&diff_format=u
Index: php-src/ext/readline/readline.c
diff -u php-src/ext/readline/readline.c:1.61 
php-src/ext/readline/readline.c:1.62
--- php-src/ext/readline/readline.c:1.61        Wed Jan  7 22:54:43 2009
+++ php-src/ext/readline/readline.c     Fri Jan 16 00:07:25 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: readline.c,v 1.61 2009/01/07 22:54:43 felipe Exp $ */
+/* $Id: readline.c,v 1.62 2009/01/16 00:07:25 iliaa Exp $ */
 
 /* {{{ includes & prototypes */
 
@@ -216,17 +216,16 @@
    Gets/sets various internal readline variables. */
 PHP_FUNCTION(readline_info)
 {
-       char *what;
-       zval **value;
+       char *what = NULL;
+       zval **value = NULL;
        int what_len, oldval;
        char *oldstr;
-       int ac = ZEND_NUM_ARGS();
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sZ", &what, 
&what_len, &value) == FAILURE) {
                return;
        }
 
-       if (ac == 0) {
+       if (what) {
                array_init(return_value);
                
add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1);
                add_assoc_long(return_value,"point",rl_point);
@@ -246,7 +245,7 @@
        } else {
                if (!strcasecmp(what,"line_buffer")) {
                        oldstr = rl_line_buffer;
-                       if (ac == 2) {
+                       if (value) {
                                /* XXX if (rl_line_buffer) 
free(rl_line_buffer); */
                                convert_to_string_ex(value);
                                rl_line_buffer = strdup(Z_STRVAL_PP(value));
@@ -261,14 +260,14 @@
                        RETVAL_LONG(rl_mark);
                } else if (!strcasecmp(what, "done")) {
                        oldval = rl_done;
-                       if (ac == 2) {
+                       if (value) {
                                convert_to_long_ex(value);
                                rl_done = Z_LVAL_PP(value);
                        }
                        RETVAL_LONG(oldval);
                } else if (!strcasecmp(what, "pending_input")) {
                        oldval = rl_pending_input;
-                       if (ac == 2) {
+                       if (value) {
                                convert_to_string_ex(value);
                                rl_pending_input = Z_STRVAL_PP(value)[0];
                        }
@@ -281,7 +280,7 @@
 #if HAVE_ERASE_EMPTY_LINE
                } else if (!strcasecmp(what, "erase_empty_line")) {
                        oldval = rl_erase_empty_line;
-                       if (ac == 2) {
+                       if (value) {
                                convert_to_long_ex(value);
                                rl_erase_empty_line = Z_LVAL_PP(value);
                        }
@@ -291,7 +290,7 @@
                        RETVAL_STRING((char 
*)SAFE_STRING(rl_library_version),1);
                } else if (!strcasecmp(what, "readline_name")) {
                        oldstr = (char*)rl_readline_name;
-                       if (ac == 2) {
+                       if (value) {
                                /* XXX if (rl_readline_name) 
free(rl_readline_name); */
                                convert_to_string_ex(value);
                                rl_readline_name = strdup(Z_STRVAL_PP(value));;



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

Reply via email to