com php-src: tidy: phpdbg_cmd.c
| From: | Bob Weinand | Date: | Wed, 20 Nov 2013 22:03:36 +0000 |
| Subject: | com php-src: tidy: phpdbg_cmd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74735@lists.php.net to get a copy of this message | ||
Commit: 1c046c02b8001f114fc14997f3b14492da74b219
Author: krakjoe <joe.watkins@live.co.uk> Wed, 20 Nov 2013 22:03:36 +0000
Parents: 5ec586ce94f4f87c976ee83866f18098f0289f91
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c046c02b8001f114fc14997f3b14492da74b219
Log:
tidy
Changed paths:
M phpdbg_cmd.c
Diff:
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index 4aefde3..b324079 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -321,25 +321,21 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, phpdbg_input_t *input
TSRMLS_
if (input->argc > 1) {
if (command->subs) {
- phpdbg_input_t sub;
-
- sub.length = input->length;
- sub.string = input->string;
- sub.start = input->start;
+ phpdbg_input_t sub = *input;
sub.string += input->argv[0]->length;
sub.length -= input->argv[0]->length;
- while (isspace(*sub.string)) {
- sub.string++;
- sub.length--;
- }
- sub.argc = input->argc-1;
- sub.argv = &input->argv[1];
- sub.string = estrndup(sub.string, sub.length);
+
+ sub.string = phpdbg_trim(
+ sub.string, sub.length, &sub.length);
+
+ sub.argc--;
+ sub.argv++;
phpdbg_debug(
"trying sub commands in \"%s\" for \"%s\" with %d arguments",
command->name, sub.argv[0]->string, sub.argc-1);
+
if (phpdbg_do_cmd(command->subs, &sub TSRMLS_CC) == SUCCESS) {
efree(sub.string);
return SUCCESS;
@@ -351,11 +347,10 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, phpdbg_input_t *input
TSRMLS_
input->string += input->argv[0]->length;
input->length -= input->argv[0]->length;
- while (isspace(*input->string)) {
- input->string++;
- input->length--;
- }
- input->string = estrndup(input->string, input->length);
+
+ input->string = phpdbg_trim(
+ input->string, input->length, &input->length);
+
efree(store);
}