com php-src: more tidy: phpdbg_cmd.c phpdbg_cmd.h p hpdbg_prompt.c

From: Date: Tue, 19 Nov 2013 13:00:04 +0000
Subject: com php-src: more tidy: phpdbg_cmd.c phpdbg_cmd.h p hpdbg_prompt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74803@lists.php.net to get a copy of this message
Commit: 73e7f5c645ef54a169eb845f26ad242490ea0c2e Author: krakjoe <joe.watkins@live.co.uk> Tue, 19 Nov 2013 13:00:04 +0000 Parents: d906613eb56f67349132cfe74b2a1679fbe332d9 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=73e7f5c645ef54a169eb845f26ad242490ea0c2e Log: more tidy Changed paths: M phpdbg_cmd.c M phpdbg_cmd.h M phpdbg_prompt.c Diff: diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index 93f57a8..41dead1 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -159,6 +159,8 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */ memcpy( buffer->string, cmd, buffer->length); buffer->string[buffer->length] = '\0'; + /* store constant pointer to start of buffer */ + buffer->start = (char* const*) buffer->string; } } diff --git a/phpdbg_cmd.h b/phpdbg_cmd.h index 7764b5d..03fbd0a 100644 --- a/phpdbg_cmd.h +++ b/phpdbg_cmd.h @@ -41,8 +41,9 @@ typedef enum { } phpdbg_param_type; typedef struct { + char* const* start; char *string; - size_t length; + size_t length; } phpdbg_input_t; typedef struct _phpdbg_param { diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 01f57f2..92e39ec 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -910,8 +910,12 @@ static PHPDBG_COMMAND(list) /* {{{ */ return SUCCESS; } /* }}} */ -static inline int phpdbg_call_register(const char *cmd, size_t cmd_len, const char * start TSRMLS_DC) /* {{{ */ +static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */ { + /* temporary, until we can handle arrays of strings */ + const char *cmd = input->string; + size_t cmd_len = input->length; + const char *start = (const char*) input->start; size_t offset = strlen(cmd)+(sizeof(" ")-1); if (zend_hash_exists(&PHPDBG_G(registered), cmd, strlen(cmd))) { @@ -966,12 +970,10 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ phpdbg_input_t* input = phpdbg_read_input(TSRMLS_C); if (input) { - char* const* saved = (char* const*) input->string; - switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input->string, input->length TSRMLS_CC)) { case FAILURE: if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { - if (phpdbg_call_register(input->string, input->length, (const char*) saved TSRMLS_CC) == FAILURE) { + if (phpdbg_call_register(input TSRMLS_CC) == FAILURE) { phpdbg_error("Failed to execute %s!", input->string); } }

« previous php.cvs (#74803) next »