com php-src: Small phpdbg cleanups: sapi/phpdbg/phpdbg.c
| From: | Nikita Popov | Date: | Tue, 29 Oct 2019 10:39:02 +0000 |
| Subject: | com php-src: Small phpdbg cleanups: sapi/phpdbg/phpdbg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109111@lists.php.net to get a copy of this message | ||
Commit: 1c9cbc911d83a64d1dd7ef9c8d12b999d99cafdb
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 29 Oct 2019 11:39:02 +0100
Parents: 504f7ffdd656cca19576d54dfe94ecc800cc2a42
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c9cbc911d83a64d1dd7ef9c8d12b999d99cafdb
Log:
Small phpdbg cleanups
Add a zpp_none() call, convert E_ERROR to ValueError.
Changed paths:
M sapi/phpdbg/phpdbg.c
Diff:
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 0e487b5e57c..436adb23c43 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -332,13 +332,18 @@ static PHP_FUNCTION(phpdbg_exec)
instructs phpdbg to insert a breakpoint at the next opcode */
static PHP_FUNCTION(phpdbg_break_next)
{
- zend_execute_data *ex = EG(current_execute_data);
+ zend_execute_data *ex;
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ ex = EG(current_execute_data);
while (ex && ex->func && !ZEND_USER_CODE(ex->func->type)) {
ex = ex->prev_execute_data;
}
- if (zend_parse_parameters_none() == FAILURE || !ex) {
+ if (!ex) {
return;
}
@@ -362,8 +367,8 @@ static PHP_FUNCTION(phpdbg_break_file)
/* {{{ proto void phpdbg_break_method(string class, string method) */
static PHP_FUNCTION(phpdbg_break_method)
{
- char *class = NULL, *method = NULL;
- size_t clen = 0, mlen = 0;
+ char *class, *method;
+ size_t clen, mlen;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method,
&mlen) == FAILURE) {
return;
@@ -375,7 +380,7 @@ static PHP_FUNCTION(phpdbg_break_method)
/* {{{ proto void phpdbg_break_function(string function) */
static PHP_FUNCTION(phpdbg_break_function)
{
- char *function = NULL;
+ char *function;
size_t function_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) ==
FAILURE) {
@@ -389,6 +394,10 @@ static PHP_FUNCTION(phpdbg_break_function)
instructs phpdbg to clear breakpoints */
static PHP_FUNCTION(phpdbg_clear)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
@@ -418,7 +427,8 @@ static PHP_FUNCTION(phpdbg_color)
phpdbg_set_color_ex(element, color, color_len);
break;
- default: zend_error(E_ERROR, "phpdbg detected an incorrect color constant");
+ default:
+ zend_value_error("phpdbg detected an incorrect color constant");
}
} /* }}} */