diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2013-11-25 23:45:55 +0100 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2013-11-25 23:45:55 +0100 |
commit | 02ae3f8de1799d5ae4a6fa2cc86a34acb4767e9c (patch) | |
tree | e09cccc2933e87519fba1465178e819213b68893 /phpdbg.c | |
parent | 4e6a8eeffa4cdec4b75303788e676468fdf6129e (diff) | |
download | php-git-02ae3f8de1799d5ae4a6fa2cc86a34acb4767e9c.tar.gz |
Merge branch 'master' of https://github.com/krakjoe/phpdbg
Diffstat (limited to 'phpdbg.c')
-rw-r--r-- | phpdbg.c | 36 |
1 files changed, 19 insertions, 17 deletions
@@ -78,7 +78,7 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ REGISTER_LONG_CONSTANT("PHPDBG_COLOR_PROMPT", PHPDBG_COLOR_PROMPT, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHPDBG_COLOR_NOTICE", PHPDBG_COLOR_NOTICE, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHPDBG_COLOR_ERROR", PHPDBG_COLOR_ERROR, CONST_CS|CONST_PERSISTENT); - + return SUCCESS; } /* }}} */ @@ -162,6 +162,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */ if (PHPDBG_G(prompt)[0]) { free(PHPDBG_G(prompt)[0]); } + if (PHPDBG_G(prompt)[1]) { free(PHPDBG_G(prompt)[1]); } @@ -249,32 +250,32 @@ static PHP_FUNCTION(phpdbg_color) long element; char *color; zend_uint color_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &element, &color, &color_len) == FAILURE) { return; } - + switch (element) { case PHPDBG_COLOR_NOTICE: case PHPDBG_COLOR_ERROR: case PHPDBG_COLOR_PROMPT: phpdbg_set_color_ex(element, color, color_len TSRMLS_CC); break; - + default: zend_error(E_ERROR, "phpdbg detected an incorrect color constant"); } } /* }}} */ /* {{{ proto void phpdbg_prompt(string prompt) */ -static PHP_FUNCTION(phpdbg_prompt) +static PHP_FUNCTION(phpdbg_prompt) { char *prompt; zend_uint prompt_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &prompt, &prompt_len) == FAILURE) { return; } - + phpdbg_set_prompt(prompt TSRMLS_CC); } /* }}} */ @@ -565,19 +566,21 @@ int main(int argc, char **argv) /* {{{ */ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif +phpdbg_main: #ifdef ZTS tsrm_startup(1, 1, 0, NULL); tsrm_ls = ts_resource(0); #endif - bp_tmp_file = malloc(L_tmpnam); - tmpnam(bp_tmp_file); - if (bp_tmp_file == NULL) { - phpdbg_error("Unable to create temporary file"); + if (!cleaning) { + bp_tmp_file = malloc(L_tmpnam); + tmpnam(bp_tmp_file); + if (bp_tmp_file == NULL) { + phpdbg_error("Unable to create temporary file"); + } } -phpdbg_main: ini_entries = NULL; ini_entries_len = 0; ini_ignore = 0; @@ -858,16 +861,15 @@ phpdbg_out: sapi_shutdown(); } +#ifdef ZTS + tsrm_shutdown(); +#endif + if (cleaning) { goto phpdbg_main; } free(bp_tmp_file); -#ifdef ZTS - /* bugggy */ - /* tsrm_shutdown(); */ -#endif - return 0; } /* }}} */ |