Skip to content

Commit dee048c

Browse files
committed
- WS, removed unused var
1 parent 5af3714 commit dee048c

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

phpdbg_cmd.c

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,24 @@ void phpdbg_clear_param(phpdbg_param_t *param TSRMLS_DC) /* {{{ */
115115
break;
116116
}
117117
}
118-
118+
119119
} /* }}} */
120120

121121
static inline phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_DC) /* {{{ */
122122
{
123-
char *p, *s;
123+
char *p;
124124
char b[PHPDBG_MAX_CMD];
125125
int l=0;
126126
enum states {
127127
IN_BETWEEN,
128-
IN_WORD,
129-
IN_STRING
128+
IN_WORD,
129+
IN_STRING
130130
} state = IN_BETWEEN;
131131
phpdbg_input_t **argv = NULL;
132-
132+
133133
argv = (phpdbg_input_t**) emalloc(sizeof(phpdbg_input_t**));
134134
(*argc) = 0;
135-
135+
136136
#define RESET_STATE() do {\
137137
phpdbg_input_t *arg = emalloc(sizeof(phpdbg_input_t));\
138138
if (arg) {\
@@ -157,11 +157,9 @@ static inline phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_D
157157
}
158158
if (c == '"') {
159159
state = IN_STRING;
160-
s = p + 1;
161160
continue;
162161
}
163162
state = IN_WORD;
164-
s = p;
165163
b[l++]=c;
166164
continue;
167165

@@ -186,39 +184,39 @@ static inline phpdbg_input_t** phpdbg_read_argv(char *buffer, int *argc TSRMLS_D
186184
continue;
187185
}
188186
}
189-
187+
190188
switch (state) {
191189
case IN_WORD: {
192190
RESET_STATE();
193191
} break;
194-
192+
195193
case IN_STRING:
196194
phpdbg_error(
197-
"Malformed command line (unclosed quote) @ %d: %s!",
195+
"Malformed command line (unclosed quote) @ %d: %s!",
198196
(p - buffer)-1, &buffer[(p - buffer)-1]);
199197
break;
200198
}
201-
199+
202200
if ((*argc) == 0) {
203201
/* not needed */
204202
efree(argv);
205-
203+
206204
/* to be sure */
207205
return NULL;
208206
}
209-
207+
210208
return argv;
211209
} /* }}} */
212210

213-
phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
211+
phpdbg_input_t *phpdbg_read_input(TSRMLS_D) /* {{{ */
214212
{
215213
if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
216214
phpdbg_input_t *buffer = NULL;
217215
size_t cmd_len = 0L;
218216

219217
#ifndef HAVE_LIBREADLINE
220218
char *cmd = NULL;
221-
char buf[PHPDBG_MAX_CMD];
219+
char buf[PHPDBG_MAX_CMD];
222220
if (!phpdbg_write(PROMPT) ||
223221
!fgets(buf, PHPDBG_MAX_CMD, stdin)) {
224222
/* the user has gone away */
@@ -227,7 +225,7 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
227225
zend_bailout();
228226
return NULL;
229227
}
230-
228+
231229
cmd = buf;
232230
#else
233231
char *cmd = readline(PROMPT);
@@ -249,7 +247,7 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
249247
while (*cmd && isspace(cmd[cmd_len-1]))
250248
cmd_len--;
251249
cmd[cmd_len] = '\0';
252-
250+
253251
/* allocate and sanitize buffer */
254252
buffer = (phpdbg_input_t*) emalloc(sizeof(phpdbg_input_t));
255253
if (buffer) {
@@ -261,24 +259,24 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
261259
buffer->string[buffer->length] = '\0';
262260
/* store constant pointer to start of buffer */
263261
buffer->start = (char* const*) buffer->string;
264-
{
265-
/* temporary, when we switch to argv/argc handling
262+
{
263+
/* temporary, when we switch to argv/argc handling
266264
will be unnecessary */
267265
char *store = (char*) estrdup(buffer->string);
268-
266+
269267
buffer->argv = phpdbg_read_argv(
270268
store, &buffer->argc TSRMLS_CC);
271-
269+
272270
if (buffer->argc) {
273271
int arg = 0;
274-
272+
275273
while (arg < buffer->argc) {
276274
phpdbg_debug(
277275
"argv %d=%s", arg, buffer->argv[arg]->string);
278276
arg++;
279277
}
280278
}
281-
279+
282280
efree(store);
283281
}
284282
}
@@ -292,18 +290,18 @@ phpdbg_input_t* phpdbg_read_input(TSRMLS_D) /* {{{ */
292290

293291
return buffer;
294292
}
295-
293+
296294
return NULL;
297295
} /* }}} */
298296

299297
void phpdbg_destroy_input(phpdbg_input_t **input TSRMLS_DC) /*{{{ */
300298
{
301299
if (*input) {
302-
300+
303301
if ((*input)->string) {
304302
efree((*input)->string);
305303
}
306-
304+
307305
if ((*input)->argc > 0) {
308306
int arg;
309307
for (arg=0; arg<(*input)->argc; arg++) {
@@ -315,7 +313,7 @@ void phpdbg_destroy_input(phpdbg_input_t **input TSRMLS_DC) /*{{{ */
315313
if ((*input)->argv) {
316314
efree((*input)->argv);
317315
}
318-
316+
319317
efree(*input);
320318
}
321319
} /* }}} */
@@ -326,29 +324,29 @@ int phpdbg_do_cmd_ex(const phpdbg_command_t *command, phpdbg_input_t *input TSRM
326324

327325
if (input->argc > 0) {
328326
while (command && command->name && command->handler) {
329-
if (((command->name_len == input->argv[0]->length) &&
327+
if (((command->name_len == input->argv[0]->length) &&
330328
(memcmp(command->name, input->argv[0]->string, command->name_len) == SUCCESS)) ||
331329
(command->alias &&
332-
(input->argv[0]->length == 1) &&
330+
(input->argv[0]->length == 1) &&
333331
(command->alias == *input->argv[0]->string))) {
334332
if (command->subs && input->argc > 1) {
335333
phpdbg_input_t sub;
336-
334+
337335
sub.argc = input->argc-1;
338336
sub.argv = &input->argv[1];
339-
337+
340338
return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC);
341339
}
342-
340+
343341
phpdbg_debug(
344-
"found command %s for %s with %d arguments",
342+
"found command %s for %s with %d arguments",
345343
command->name, input->argv[0]->string, input->argc-1);
346344
{
347345
int arg;
348346
for (arg=1; arg<input->argc; arg++) {
349347
phpdbg_debug(
350-
"\t#%d: [%s=%d]",
351-
arg,
348+
"\t#%d: [%s=%d]",
349+
arg,
352350
input->argv[arg]->string,
353351
input->argv[arg]->length);
354352
}
@@ -362,7 +360,7 @@ int phpdbg_do_cmd_ex(const phpdbg_command_t *command, phpdbg_input_t *input TSRM
362360
phpdbg_error(
363361
"No function executed !!");
364362
}
365-
363+
366364
return rc;
367365
} /* }}} */
368366

@@ -385,7 +383,7 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
385383
expr,
386384
(cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
387385
&param TSRMLS_CC);
388-
386+
389387
if (command->subs && param.type == STR_PARAM) {
390388
if (phpdbg_do_cmd(command->subs, param.str, param.len TSRMLS_CC) == SUCCESS) {
391389
rc = SUCCESS;

0 commit comments

Comments
 (0)