com php-src: improve api: phpdbg_bp.c phpdbg_break.c phpdbg_cmd.c phpdbg_cmd.h

From: Date: Wed, 27 Nov 2013 09:55:16 +0000
Subject: com php-src: improve api: phpdbg_bp.c phpdbg_break.c phpdbg_cmd.c phpdbg_cmd.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74578@lists.php.net to get a copy of this message
Commit: 37b3a21cf4802b0091d42c79c020bce1199641f7 Author: krakjoe <joe.watkins@live.co.uk> Wed, 27 Nov 2013 09:55:16 +0000 Parents: 3df8e29b0d24d378d168183028aed46c1826a511 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=37b3a21cf4802b0091d42c79c020bce1199641f7 Log: improve api Changed paths: M phpdbg_bp.c M phpdbg_break.c M phpdbg_cmd.c M phpdbg_cmd.h Diff: diff --git a/phpdbg_bp.c b/phpdbg_bp.c index 61c8f74..8221628 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -66,7 +66,7 @@ PHPDBG_API void phpdbg_export_breakpoints(FILE *handle TSRMLS_DC) /* {{{ */ phpdbg_notice( "Exporting %ld breakpoints", zend_hash_num_elements(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP])); - + /* this only looks like magic, it isn't */ for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], &position[0]); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], (void**)&table, &position[0]) == SUCCESS; zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], &position[0])) { diff --git a/phpdbg_break.c b/phpdbg_break.c index 1b9b14b..a8a5677 100644 --- a/phpdbg_break.c +++ b/phpdbg_break.c @@ -48,7 +48,7 @@ PHPDBG_BREAK(method) /* {{{ */ phpdbg_default_switch_case(); } - + return SUCCESS; } /* }}} */ diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index e9a81c9..e01645f 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -246,7 +246,7 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */ } else cmd = buffered; /* allocate and sanitize buffer */ - buffer = (phpdbg_input_t*) emalloc(sizeof(phpdbg_input_t)); + buffer = (phpdbg_input_t*) ecalloc(1, sizeof(phpdbg_input_t)); if (!buffer) { return NULL; } @@ -283,25 +283,31 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */ return NULL; } /* }}} */ -PHPDBG_API void phpdbg_destroy_input(phpdbg_input_t **input TSRMLS_DC) /*{{{ */ +PHPDBG_API void phpdbg_destroy_argv(phpdbg_input_t **argv, int argc TSRMLS_DC) /* {{{ */ { - if (*input) { - if ((*input)->string) { - efree((*input)->string); - } - - if ((*input)->argc > 0) { + if (argv) { + if (argc) { int arg; - for (arg=0; arg<(*input)->argc; arg++) { + for (arg=0; arg<argc; arg++) { phpdbg_destroy_input( - &(*input)->argv[arg] TSRMLS_CC); + &argv[arg] TSRMLS_CC); } } + efree(argv); + } + +} /* }}} */ - if ((*input)->argv) { - efree((*input)->argv); +PHPDBG_API void phpdbg_destroy_input(phpdbg_input_t **input TSRMLS_DC) /*{{{ */ +{ + if (*input) { + if ((*input)->string) { + efree((*input)->string); } + phpdbg_destroy_argv( + (*input)->argv, (*input)->argc TSRMLS_CC); + efree(*input); } } /* }}} */ diff --git a/phpdbg_cmd.h b/phpdbg_cmd.h index d72cb5b..fcb9687 100644 --- a/phpdbg_cmd.h +++ b/phpdbg_cmd.h @@ -112,8 +112,13 @@ typedef struct { * Input Management */ PHPDBG_API phpdbg_input_t* phpdbg_read_input(char *buffered TSRMLS_DC); -PHPDBG_API phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_DC); PHPDBG_API void phpdbg_destroy_input(phpdbg_input_t** TSRMLS_DC); + +/* +* Argument Management +*/ +PHPDBG_API phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_DC); +PHPDBG_API void phpdbg_destroy_argv(phpdbg_input_t **argv, int argc TSRMLS_DC); #define phpdbg_argv_is(n, s) \ (memcmp(input->argv[n]->string, s, input->argv[n]->length-1) == SUCCESS)

« previous php.cvs (#74578) next »