Merge branch 'master' of github.com:krakjoe/phpdbg

This commit is contained in:
Felipe Pena 2013-11-18 20:08:31 -02:00
commit 723c671750
5 changed files with 61 additions and 38 deletions

View file

@ -99,20 +99,23 @@ parsed:
void phpdbg_clear_param(phpdbg_param_t *param TSRMLS_DC) /* {{{ */
{
switch (param->type) {
case FILE_PARAM:
efree(param->file.name);
break;
case METHOD_PARAM:
efree(param->method.class);
efree(param->method.name);
break;
case STR_PARAM:
efree(param->str);
break;
default:
break;
if (param) {
switch (param->type) {
case FILE_PARAM:
efree(param->file.name);
break;
case METHOD_PARAM:
efree(param->method.class);
efree(param->method.name);
break;
case STR_PARAM:
efree(param->str);
break;
default:
break;
}
}
} /* }}} */
int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_len TSRMLS_DC) /* {{{ */
@ -129,20 +132,13 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
while (command && command->name && command->handler) {
if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0)
|| (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
phpdbg_param_t lparam,
param;
phpdbg_param_t param = {0};
phpdbg_parse_param(
expr,
(cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
&param TSRMLS_CC);
lparam = PHPDBG_G(lparam);
PHPDBG_G(lparam) = param;
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
if (command->subs && param.type == STR_PARAM) {
if (phpdbg_do_cmd(command->subs, param.str, param.len TSRMLS_CC) == SUCCESS) {
rc = SUCCESS;
@ -157,10 +153,12 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
phpdbg_error("This command does not expect argument!");
rc = FAILURE;
} else {
rc = command->handler(&param TSRMLS_CC);
rc = command->handler(
&param TSRMLS_CC);
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
PHPDBG_G(lparam) = param;
}
phpdbg_clear_param(&lparam TSRMLS_CC);
break;
}
++command;