/* {{{ */
PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) {
phpdbg_param_t *next = calloc(1, sizeof(phpdbg_param_t));
-
+
if (!next)
return;
-
+
*(next) = *(param);
+ next->next = NULL;
+
if (stack->top == NULL) {
stack->top = next;
+ next->top = NULL;
stack->next = next;
} else {
stack->top->next = next;
next->top = stack->top;
stack->top = next;
}
-
+
stack->len++;
} /* }}} */
char *why = NULL;
char *input = NULL;
phpdbg_param_t stack;
-
+
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
input = phpdbg_read_input(NULL TSRMLS_CC);
-
+
if (input) {
do {
yyscan_t scanner;
YY_BUFFER_STATE state;
phpdbg_init_param(&stack, STACK_PARAM);
-
+
if (yylex_init(&scanner)) {
phpdbg_error(
"could not initialize scanner");
}
state = yy_scan_string(input, scanner);
-
+
if (yyparse(&stack, scanner) <= 0) {
switch (ret = phpdbg_stack_execute(&stack, &why TSRMLS_CC)) {
case FAILURE:
}
}
}
-
+
if (why) {
free(why);
why = NULL;
out:
if (input) {
+ phpdbg_stack_free(&stack);
phpdbg_destroy_input(&input TSRMLS_CC);
}
if (why) {
free(why);
}
-
- phpdbg_stack_free(&stack);
if (EG(in_execution)) {
phpdbg_restore_frame(TSRMLS_C);