- Added llist dtor

This commit is contained in:
Felipe Pena 2013-11-10 13:47:28 -02:00
parent 9552817864
commit 6069121e23
2 changed files with 26 additions and 12 deletions

View File

@ -23,34 +23,39 @@ ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
void (*zend_execute_old)(zend_execute_data *execute_data TSRMLS_DC);
void (*zend_execute_internal_old)(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC);
static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) {
static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
{
pg->exec = NULL;
pg->ops = NULL;
pg->stepping = 0;
pg->vmret = 0;
}
} /* }}} */
static PHP_MINIT_FUNCTION(phpdbg) {
static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
{
ZEND_INIT_MODULE_GLOBALS(phpdbg, php_phpdbg_globals_ctor, NULL);
zend_execute_old = zend_execute_ex;
zend_execute_ex = phpdbg_execute_ex;
return SUCCESS;
}
} /* }}} */
static inline void php_phpdbg_destroy_break(void *brake) {
static void php_phpdbg_destroy_break(void *brake) /* {{{ */
{
zend_llist_destroy((zend_llist*)brake);
} /* }}} */
}
static PHP_RINIT_FUNCTION(phpdbg) {
static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
{
zend_hash_init(&PHPDBG_G(break_files), 8, NULL, php_phpdbg_destroy_break, 0);
zend_hash_init(&PHPDBG_G(break_symbols), 8, NULL, php_phpdbg_destroy_break, 0);
return SUCCESS;
}
} /* }}} */
static PHP_RSHUTDOWN_FUNCTION(phpdbg) {
static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
{
zend_hash_destroy(&PHPDBG_G(break_files));
zend_hash_destroy(&PHPDBG_G(break_symbols));
@ -63,7 +68,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) {
efree(PHPDBG_G(ops));
}
return SUCCESS;
}
} /* }}} */
static zend_module_entry sapi_phpdbg_module_entry = {
STANDARD_MODULE_HEADER,

View File

@ -28,6 +28,13 @@ static const phpdbg_command_t phpdbg_prompt_commands[];
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
static void phpdbg_llist_breakfile_dtor(void *data)
{
phpdbg_breakfile_t *bp = (phpdbg_breakfile_t*) data;
efree(bp->filename);
}
static PHPDBG_COMMAND(exec) { /* {{{ */
if (PHPDBG_G(exec)) {
printf(
@ -187,7 +194,9 @@ static PHPDBG_COMMAND(break) /* {{{ */
if (zend_hash_find(&PHPDBG_G(break_files),
new_break.filename, name_len, (void**)&break_files_ptr) == FAILURE) {
zend_llist break_files;
zend_llist_init(&break_files, sizeof(phpdbg_breakfile_t), NULL, 0);
zend_llist_init(&break_files, sizeof(phpdbg_breakfile_t),
phpdbg_llist_breakfile_dtor, 0);
zend_hash_update(&PHPDBG_G(break_files),
new_break.filename, name_len, &break_files, sizeof(zend_llist),