[PHP-CVS] cvs: php-src /ext/readline readline.c
iliaa Thu Jan 22 14:41:15 2009 UTC Modified files: /php-src/ext/readline readline.c Log: MFB: Fixed execution condition http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.62&r2=1.63&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.62 php-src/ext/readline/readline.c:1.63 --- php-src/ext/readline/readline.c:1.62Fri Jan 16 00:07:25 2009 +++ php-src/ext/readline/readline.c Thu Jan 22 14:41:15 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.62 2009/01/16 00:07:25 iliaa Exp $ */ +/* $Id: readline.c,v 1.63 2009/01/22 14:41:15 iliaa Exp $ */ /* {{{ includes & prototypes */ @@ -225,7 +225,7 @@ return; } - if (what) { + 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); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
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.61Wed 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
[PHP-CVS] cvs: php-src /ext/readline readline.c
felipe Wed Jan 7 22:54:43 2009 UTC Modified files: /php-src/ext/readline readline.c Log: - More suitable parameter checking http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.60&r2=1.61&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.60 php-src/ext/readline/readline.c:1.61 --- php-src/ext/readline/readline.c:1.60Wed Dec 31 11:12:35 2008 +++ php-src/ext/readline/readline.c Wed Jan 7 22:54:43 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.60 2008/12/31 11:12:35 sebastian Exp $ */ +/* $Id: readline.c,v 1.61 2009/01/07 22:54:43 felipe Exp $ */ /* {{{ includes & prototypes */ @@ -339,10 +339,9 @@ PHP_FUNCTION(readline_list_history) { HIST_ENTRY **history; - int ac = ZEND_NUM_ARGS(); - if (ac) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters_none() == FAILURE) { + return; } history = history_list(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
felipe Fri Nov 21 22:26:49 2008 UTC Modified files: /php-src/ext/readline readline.c Log: - Fixed memory leak in readline_callback_handler_remove() http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.58&r2=1.59&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.58 php-src/ext/readline/readline.c:1.59 --- php-src/ext/readline/readline.c:1.58Thu Nov 20 22:23:53 2008 +++ php-src/ext/readline/readline.c Fri Nov 21 22:26:49 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.58 2008/11/20 22:23:53 felipe Exp $ */ +/* $Id: readline.c,v 1.59 2008/11/21 22:26:49 felipe Exp $ */ /* {{{ includes & prototypes */ @@ -551,7 +551,8 @@ if (_prepped_callback) { rl_callback_handler_remove(); - zval_ptr_dtor(&_prepped_callback); + zval_dtor(_prepped_callback); + FREE_ZVAL(_prepped_callback); } MAKE_STD_ZVAL(_prepped_callback); @@ -580,6 +581,7 @@ { if (_prepped_callback) { rl_callback_handler_remove(); + zval_dtor(_prepped_callback); FREE_ZVAL(_prepped_callback); _prepped_callback = 0; RETURN_TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c /ext/readline/tests readline_completion_function_001.phpt
felipe Thu Nov 20 22:23:53 2008 UTC Added files: /php-src/ext/readline/tests readline_completion_function_001.phpt Modified files: /php-src/ext/readline readline.c Log: - Fixed memory leaks in readline_completion_function() http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.57&r2=1.58&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.57 php-src/ext/readline/readline.c:1.58 --- php-src/ext/readline/readline.c:1.57Mon Nov 17 11:26:23 2008 +++ php-src/ext/readline/readline.c Thu Nov 20 22:23:53 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.57 2008/11/17 11:26:23 felipe Exp $ */ +/* $Id: readline.c,v 1.58 2008/11/20 22:23:53 felipe Exp $ */ /* {{{ includes & prototypes */ @@ -169,8 +169,10 @@ PHP_RSHUTDOWN_FUNCTION(readline) { - if (_readline_completion) + if (_readline_completion) { + zval_dtor(_readline_completion); FREE_ZVAL(_readline_completion); + } #if HAVE_RL_CALLBACK_READ_CHAR if (_prepped_callback) { rl_callback_handler_remove(); @@ -494,6 +496,7 @@ zval_dtor(&name); if (_readline_completion) { + zval_dtor(_readline_completion); FREE_ZVAL(_readline_completion); } http://cvs.php.net/viewvc.cgi/php-src/ext/readline/tests/readline_completion_function_001.phpt?view=markup&rev=1.1 Index: php-src/ext/readline/tests/readline_completion_function_001.phpt +++ php-src/ext/readline/tests/readline_completion_function_001.phpt --TEST-- readline_completion_function(): Basic test --SKIPIF-- --FILE-- --EXPECTF-- Warning: readline_completion_function(): 1 is not callable in %s on line %d Warning: readline_completion_function(): 1.1231 is not callable in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
iliaa Sun Nov 16 18:02:17 2008 UTC Modified files: /php-src/ext/readline readline.c Log: MFB: Fixed memory leak inside readline_callback_handler_install() function http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.55&r2=1.56&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.55 php-src/ext/readline/readline.c:1.56 --- php-src/ext/readline/readline.c:1.55Sun Nov 2 21:10:10 2008 +++ php-src/ext/readline/readline.c Sun Nov 16 18:02:17 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.55 2008/11/02 21:10:10 felipe Exp $ */ +/* $Id: readline.c,v 1.56 2008/11/16 18:02:17 iliaa Exp $ */ /* {{{ includes & prototypes */ @@ -187,7 +187,7 @@ #if HAVE_RL_CALLBACK_READ_CHAR if (_prepped_callback) { rl_callback_handler_remove(); - FREE_ZVAL(_prepped_callback); + zval_ptr_dtor(&_prepped_callback); _prepped_callback = 0; } #endif @@ -561,7 +561,7 @@ if (_prepped_callback) { rl_callback_handler_remove(); - FREE_ZVAL(_prepped_callback); + zval_ptr_dtor(&_prepped_callback); } MAKE_STD_ZVAL(_prepped_callback); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
felipe Mon Jul 14 18:06:19 2008 UTC Modified files: /php-src/ext/readline readline.c Log: - MFB: Added arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.51&r2=1.52&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.51 php-src/ext/readline/readline.c:1.52 --- php-src/ext/readline/readline.c:1.51Wed Jun 25 16:22:13 2008 +++ php-src/ext/readline/readline.c Mon Jul 14 18:06:19 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.51 2008/06/25 16:22:13 felipe Exp $ */ +/* $Id: readline.c,v 1.52 2008/07/14 18:06:19 felipe Exp $ */ /* {{{ includes & prototypes */ @@ -67,25 +67,92 @@ PHP_RSHUTDOWN_FUNCTION(readline); /* }}} */ -/* {{{ module stuff */ +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline, 0, 0, 0) + ZEND_ARG_INFO(0, prompt) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0) + ZEND_ARG_INFO(0, varname) + ZEND_ARG_INFO(0, newvalue) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_add_history, 0, 0, 1) + ZEND_ARG_INFO(0, prompt) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_clear_history, 0) +ZEND_END_ARG_INFO() + +#ifndef HAVE_LIBEDIT +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_list_history, 0) +ZEND_END_ARG_INFO() +#endif + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_read_history, 0, 0, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_write_history, 0, 0, 0) + ZEND_ARG_INFO(0, filename) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_completion_function, 0, 0, 1) + ZEND_ARG_INFO(0, funcname) +ZEND_END_ARG_INFO() + +#if HAVE_RL_CALLBACK_READ_CHAR +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_callback_handler_install, 0, 0, 2) + ZEND_ARG_INFO(0, prompt) + ZEND_ARG_INFO(0, callback) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_read_char, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_handler_remove, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_redisplay, 0) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_readline_on_new_line, 0) +ZEND_END_ARG_INFO() +#endif +/* }}} */ + +/* {{{ module stuff */ static const zend_function_entry php_readline_functions[] = { - PHP_FE(readline,NULL) - PHP_FE(readline_info, NULL) - PHP_FE(readline_add_history,NULL) - PHP_FE(readline_clear_history, NULL) + PHP_FE(readline,arginfo_readline) + PHP_FE(readline_info, arginfo_readline_info) + PHP_FE(readline_add_history,arginfo_readline_add_history) + PHP_FE(readline_clear_history, arginfo_readline_clear_history) #ifndef HAVE_LIBEDIT - PHP_FE(readline_list_history, NULL) + PHP_FE(readline_list_history, arginfo_readline_list_history) #endif - PHP_FE(readline_read_history, NULL) - PHP_FE(readline_write_history, NULL) - PHP_FE(readline_completion_function,NULL) + PHP_FE(readline_read_history, arginfo_readline_read_history) + PHP_FE(readline_write_history, arginfo_readline_write_history) + PHP_FE(readline_completion_function,arginfo_readline_completion_function) #if HAVE_RL_CALLBACK_READ_CHAR - PHP_FE(readline_callback_handler_install, NULL) - PHP_FE(readline_callback_read_char, NULL) - PHP_FE(readline_callback_handler_remove,NULL) - PHP_FE(readline_redisplay, NULL) - PHP_FE(readline_on_new_line, NULL) + PHP_FE(readline_callback_handler_install, arginfo_readline_callback_handler_install) + PHP_FE(readline_callback_read_char, arginfo_readline_callback_read_char) + PHP_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove) + PHP_FE(readline_redisplay, arginfo_readline_redisplay) + PHP_FE(readline_on_new_line, arginfo_readline_on_new_line) #endif {NULL, NULL, NULL} }; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
felipe Wed Jun 25 16:22:13 2008 UTC Modified files: /php-src/ext/readline readline.c Log: - New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.50&r2=1.51&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.50 php-src/ext/readline/readline.c:1.51 --- php-src/ext/readline/readline.c:1.50Mon Dec 31 07:12:13 2007 +++ php-src/ext/readline/readline.c Wed Jun 25 16:22:13 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.50 2007/12/31 07:12:13 sebastian Exp $ */ +/* $Id: readline.c,v 1.51 2008/06/25 16:22:13 felipe Exp $ */ /* {{{ includes & prototypes */ @@ -154,21 +154,20 @@ /* }}} */ -/* {{{ proto mixed readline_info([string varname] [, string newvalue]) - Gets/sets various internal readline variables. */ - #define SAFE_STRING(s) ((s)?(char*)(s):"") +/* {{{ proto mixed readline_info([string varname [, string newvalue]]) + Gets/sets various internal readline variables. */ PHP_FUNCTION(readline_info) { - zval **what; + char *what; zval **value; - int oldval; + int what_len, oldval; char *oldstr; int ac = ZEND_NUM_ARGS(); - if (ac < 0 || ac > 2 || zend_get_parameters_ex(ac, &what, &value) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sZ", &what, &what_len, &value) == FAILURE) { + return; } if (ac == 0) { @@ -189,9 +188,7 @@ add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version),1); add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name),1); } else { - convert_to_string_ex(what); - - if (! strcasecmp(Z_STRVAL_PP(what),"line_buffer")) { + if (!strcasecmp(what,"line_buffer")) { oldstr = rl_line_buffer; if (ac == 2) { /* XXX if (rl_line_buffer) free(rl_line_buffer); */ @@ -199,34 +196,34 @@ rl_line_buffer = strdup(Z_STRVAL_PP(value)); } RETVAL_STRING(SAFE_STRING(oldstr),1); - } else if (! strcasecmp(Z_STRVAL_PP(what),"point")) { + } else if (!strcasecmp(what, "point")) { RETVAL_LONG(rl_point); - } else if (! strcasecmp(Z_STRVAL_PP(what),"end")) { + } else if (!strcasecmp(what, "end")) { RETVAL_LONG(rl_end); #ifdef HAVE_LIBREADLINE - } else if (! strcasecmp(Z_STRVAL_PP(what),"mark")) { + } else if (!strcasecmp(what, "mark")) { RETVAL_LONG(rl_mark); - } else if (! strcasecmp(Z_STRVAL_PP(what),"done")) { + } else if (!strcasecmp(what, "done")) { oldval = rl_done; if (ac == 2) { convert_to_long_ex(value); rl_done = Z_LVAL_PP(value); } RETVAL_LONG(oldval); - } else if (! strcasecmp(Z_STRVAL_PP(what),"pending_input")) { + } else if (!strcasecmp(what, "pending_input")) { oldval = rl_pending_input; if (ac == 2) { convert_to_string_ex(value); rl_pending_input = Z_STRVAL_PP(value)[0]; } RETVAL_LONG(oldval); - } else if (! strcasecmp(Z_STRVAL_PP(what),"prompt")) { + } else if (!strcasecmp(what, "prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt),1); - } else if (! strcasecmp(Z_STRVAL_PP(what),"terminal_name")) { + } else if (!strcasecmp(what, "terminal_name")) { RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name),1); #endif #if HAVE_ERASE_EMPTY_LINE - } else if (! strcasecmp(Z_STRVAL_PP(what),"erase_empty_line")) { + } else if (!strcasecmp(what, "erase_empty_line")) { oldval = rl_erase_empty_line; if (ac == 2) { convert_to_long_ex(value); @@ -234,9 +231,9 @@ } RETVAL_LONG(oldval); #endif - } else if (! strcasecmp(Z_STRVAL_PP(what),"library_version")) { + } else if (!strcasecmp(what,"library_version")) { RETVAL_STRING((char *)SAFE_STRING(rl_library_version),1); - } else if (! strcasecmp(Z_STRVAL_PP(what),"readline_name")) { + } else if (!strcasecmp(what, "readline_name")) {
[PHP-CVS] cvs: php-src /ext/readline readline.c
nlopess Mon Sep 4 19:00:12 2006 UTC Modified files: /php-src/ext/readline readline.c Log: MFB: fix gcc warning http://cvs.php.net/viewvc.cgi/php-src/ext/readline/readline.c?r1=1.46&r2=1.47&diff_format=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.46 php-src/ext/readline/readline.c:1.47 --- php-src/ext/readline/readline.c:1.46Sun Jan 1 13:09:53 2006 +++ php-src/ext/readline/readline.c Mon Sep 4 19:00:12 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.46 2006/01/01 13:09:53 sniper Exp $ */ +/* $Id: readline.c,v 1.47 2006/09/04 19:00:12 nlopess Exp $ */ /* {{{ includes & prototypes */ @@ -363,7 +363,7 @@ /* {{{ proto bool readline_completion_function(string funcname) Readline completion function? */ -static char *_readline_command_generator(char *text,int state) +static char *_readline_command_generator(const char *text, int state) { HashTable *myht = Z_ARRVAL(_readline_array); zval **entry; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c /ext/soap php_encoding.c
iliaa Tue Apr 12 12:41:42 2005 EDT Modified files: /php-src/ext/soap php_encoding.c /php-src/ext/readline readline.c Log: Fixed compiler warning. http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.92&r2=1.93&ty=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.92 php-src/ext/soap/php_encoding.c:1.93 --- php-src/ext/soap/php_encoding.c:1.92Mon Apr 11 21:00:48 2005 +++ php-src/ext/soap/php_encoding.c Tue Apr 12 12:41:41 2005 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +--+ */ -/* $Id: php_encoding.c,v 1.92 2005/04/12 01:00:48 iliaa Exp $ */ +/* $Id: php_encoding.c,v 1.93 2005/04/12 16:41:41 iliaa Exp $ */ #include @@ -1482,8 +1482,8 @@ /* we need to handle xml: namespace specially, since it is an implicit schema. Otherwise, use form. */ - if (!strncmp((*attr)->namens, XML_NAMESPACE, sizeof(XML_NAMESPACE)) || - ((*attr)->form == XSD_FORM_QUALIFIED) && (*attr)->namens) { + if ((!strncmp((*attr)->namens, XML_NAMESPACE, sizeof(XML_NAMESPACE)) || + ((*attr)->form == XSD_FORM_QUALIFIED)) && (*attr)->namens) { xmlNsPtr nsp = encode_add_ns(xmlParam, (*attr)->namens); xmlSetNsProp(xmlParam, nsp, (*attr)->name, dummy->children->content); http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.40&r2=1.41&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.40 php-src/ext/readline/readline.c:1.41 --- php-src/ext/readline/readline.c:1.40Thu Feb 3 19:21:50 2005 +++ php-src/ext/readline/readline.c Tue Apr 12 12:41:42 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.40 2005/02/04 00:21:50 iliaa Exp $ */ +/* $Id: readline.c,v 1.41 2005/04/12 16:41:42 iliaa Exp $ */ /* {{{ includes & prototypes */ @@ -177,13 +177,13 @@ add_assoc_long(return_value,"done",rl_done); add_assoc_long(return_value,"pending_input",rl_pending_input); add_assoc_string(return_value,"prompt",SAFE_STRING(rl_prompt),1); - add_assoc_string(return_value,"terminal_name",SAFE_STRING(rl_terminal_name),1); + add_assoc_string(return_value,"terminal_name",(char *)SAFE_STRING(rl_terminal_name),1); #endif #if HAVE_ERASE_EMPTY_LINE add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line); #endif - add_assoc_string(return_value,"library_version",SAFE_STRING(rl_library_version),1); - add_assoc_string(return_value,"readline_name",SAFE_STRING(rl_readline_name),1); + add_assoc_string(return_value,"library_version",(char *)SAFE_STRING(rl_library_version),1); + add_assoc_string(return_value,"readline_name",(char *)SAFE_STRING(rl_readline_name),1); } else { convert_to_string_ex(what); @@ -219,7 +219,7 @@ } else if (! strcasecmp(Z_STRVAL_PP(what),"prompt")) { RETVAL_STRING(SAFE_STRING(rl_prompt),1); } else if (! strcasecmp(Z_STRVAL_PP(what),"terminal_name")) { - RETVAL_STRING(SAFE_STRING(rl_terminal_name),1); + RETVAL_STRING((char *)SAFE_STRING(rl_terminal_name),1); #endif #if HAVE_ERASE_EMPTY_LINE } else if (! strcasecmp(Z_STRVAL_PP(what),"erase_empty_line")) { @@ -231,7 +231,7 @@ RETVAL_LONG(oldval); #endif } else if (! strcasecmp(Z_STRVAL_PP(what),"library_version")) { - RETVAL_STRING(SAFE_STRING(rl_library_version),1); + RETVAL_STRING((char *)SAFE_STRING(rl_library_version),1); } else if (! strcasecmp(Z_STRVAL_PP(what),"readline_name")) { oldstr = (char*)rl_readline_name; if (ac == 2) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
iliaa Thu Feb 3 19:21:50 2005 EDT Modified files: /php-src/ext/readline readline.c Log: Proper fix for bug #31796 . http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.39&r2=1.40&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.39 php-src/ext/readline/readline.c:1.40 --- php-src/ext/readline/readline.c:1.39Thu Feb 3 17:45:36 2005 +++ php-src/ext/readline/readline.c Thu Feb 3 19:21:50 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.39 2005/02/03 22:45:36 iliaa Exp $ */ +/* $Id: readline.c,v 1.40 2005/02/04 00:21:50 iliaa Exp $ */ /* {{{ includes & prototypes */ @@ -377,7 +377,7 @@ } } - return strdup(""); + return NULL; } static zval *_readline_string_zval(const char *str) @@ -420,7 +420,13 @@ if (call_user_function(CG(function_table), NULL, _readline_completion, &_readline_array, 3, params TSRMLS_CC) == SUCCESS) { if (Z_TYPE(_readline_array) == IS_ARRAY) { - matches = completion_matches(text,_readline_command_generator); + if (zend_hash_num_elements(Z_ARRVAL(_readline_array))) { + matches = completion_matches(text,_readline_command_generator); + } else { + matches = malloc(sizeof(char *) * 2); + matches[0] = strdup(""); + matches[1] = '\0'; + } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
iliaa Thu Feb 3 17:45:36 2005 EDT Modified files: /php-src/ext/readline readline.c Log: Fixed bug #31796 (readline completion handler does not handle empty return values). http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.38&r2=1.39&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.38 php-src/ext/readline/readline.c:1.39 --- php-src/ext/readline/readline.c:1.38Sun Sep 26 09:52:09 2004 +++ php-src/ext/readline/readline.c Thu Feb 3 17:45:36 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.38 2004/09/26 13:52:09 wez Exp $ */ +/* $Id: readline.c,v 1.39 2005/02/03 22:45:36 iliaa Exp $ */ /* {{{ includes & prototypes */ @@ -377,7 +377,7 @@ } } - return NULL; + return strdup(""); } static zval *_readline_string_zval(const char *str) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
wez Sun Sep 26 09:52:10 2004 EDT Modified files: /php-src/ext/readline readline.c Log: compile fix from Timm http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.37&r2=1.38&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.37 php-src/ext/readline/readline.c:1.38 --- php-src/ext/readline/readline.c:1.37Fri Sep 17 07:26:43 2004 +++ php-src/ext/readline/readline.c Sun Sep 26 09:52:09 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.37 2004/09/17 11:26:43 wez Exp $ */ +/* $Id: readline.c,v 1.38 2004/09/26 13:52:09 wez Exp $ */ /* {{{ includes & prototypes */ @@ -435,12 +435,12 @@ PHP_FUNCTION(readline_completion_function) { zval *arg = NULL; + char *name = NULL; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg)) { RETURN_FALSE; } - char *name = NULL; if (!zend_is_callable(arg, 0, &name)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s is not callable", name); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/readline readline.c
wez Fri Sep 17 07:26:43 2004 EDT Modified files: /php-src/ext/readline readline.c Log: standardize the callback support to allow array($obj, 'method') callbacks. Add a couple of utility functions. http://cvs.php.net/diff.php/php-src/ext/readline/readline.c?r1=1.36&r2=1.37&ty=u Index: php-src/ext/readline/readline.c diff -u php-src/ext/readline/readline.c:1.36 php-src/ext/readline/readline.c:1.37 --- php-src/ext/readline/readline.c:1.36Tue Aug 24 08:52:07 2004 +++ php-src/ext/readline/readline.c Fri Sep 17 07:26:43 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: readline.c,v 1.36 2004/08/24 12:52:07 wez Exp $ */ +/* $Id: readline.c,v 1.37 2004/09/17 11:26:43 wez Exp $ */ /* {{{ includes & prototypes */ @@ -49,12 +49,14 @@ PHP_FUNCTION(readline_callback_handler_install); PHP_FUNCTION(readline_callback_read_char); PHP_FUNCTION(readline_callback_handler_remove); +PHP_FUNCTION(readline_redisplay); +PHP_FUNCTION(readline_on_new_line); static zval *_prepped_callback = NULL; #endif -static char *_readline_completion = NULL; +static zval *_readline_completion = NULL; static zval _readline_array; PHP_MINIT_FUNCTION(readline); @@ -78,6 +80,8 @@ PHP_FE(readline_callback_handler_install, NULL) PHP_FE(readline_callback_read_char, NULL) PHP_FE(readline_callback_handler_remove,NULL) + PHP_FE(readline_redisplay, NULL) + PHP_FE(readline_on_new_line, NULL) #endif {NULL, NULL, NULL} }; @@ -108,7 +112,7 @@ PHP_RSHUTDOWN_FUNCTION(readline) { if (_readline_completion) - efree(_readline_completion); + FREE_ZVAL(_readline_completion); #if HAVE_RL_CALLBACK_READ_CHAR if (_prepped_callback) { rl_callback_handler_remove(); @@ -121,23 +125,20 @@ } /* }}} */ + /* {{{ proto string readline([string prompt]) Reads a line */ PHP_FUNCTION(readline) { + char *prompt = NULL; + int prompt_len; char *result; - pval **arg; - int ac = ZEND_NUM_ARGS(); - - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - if (ac == 1) { - convert_to_string_ex(arg); + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!", &prompt, &prompt_len)) { + RETURN_FALSE; } - result = readline(ac?Z_STRVAL_PP(arg):NULL); + result = readline(prompt); if (! result) { RETURN_FALSE; @@ -148,10 +149,11 @@ } /* }}} */ + /* {{{ proto mixed readline_info([string varname] [, string newvalue]) Gets/sets various internal readline variables. */ -#define SAFE_STRING(s) ((s)?(s):"") +#define SAFE_STRING(s) ((s)?(char*)(s):"") PHP_FUNCTION(readline_info) { @@ -231,7 +233,7 @@ } else if (! strcasecmp(Z_STRVAL_PP(what),"library_version")) { RETVAL_STRING(SAFE_STRING(rl_library_version),1); } else if (! strcasecmp(Z_STRVAL_PP(what),"readline_name")) { - oldstr = rl_readline_name; + oldstr = (char*)rl_readline_name; if (ac == 2) { /* XXX if (rl_readline_name) free(rl_readline_name); */ convert_to_string_ex(value); @@ -381,12 +383,17 @@ static zval *_readline_string_zval(const char *str) { zval *ret; - int len = strlen(str); + int len; + MAKE_STD_ZVAL(ret); + + if (str) { + len = strlen(str); + ZVAL_STRINGL(ret, (char*)str, len, 1); + } else { + ZVAL_NULL(ret); + } - Z_TYPE_P(ret) = IS_STRING; - Z_STRLEN_P(ret) = len; - Z_STRVAL_P(ret) = estrndup(str, len); return ret; } @@ -400,25 +407,24 @@ return ret; } -static char **_readline_completion_cb(char *text, int start, int end) +static char **_readline_completion_cb(const char *text, int start, int end) { - zval *params[4]; + zval *params[3]; int i; char **matches = NULL; TSRMLS_FETCH(); - params[0]=_readline_string_zval(_readline_completion); - params[1]=_readline_string_zval(text); - params[2]=_readline_long_zval(start); - params[3]=_readline_long_zval(end); + params[0]=_readline_string_zval(text); + params[1]=_readline_long_zval(start); + params[2]=_readline_long_zval(end); - if (call_user_function(CG(function_table), NULL, params[0], &_readline_array, 3, params+1 TSRMLS_CC) == SUCCESS) { + if (call_user_function(CG(function_table), NULL, _readline_completion, &_readline_array, 3, params TSRMLS_CC) == SUCCESS) { if (Z_TYPE(_readline_array) == IS_ARRAY) { matches =