Skip to content

Commit fbf4089

Browse files
committed
Remove spaces around parens
1 parent 666787b commit fbf4089

File tree

8 files changed

+142
-142
lines changed

8 files changed

+142
-142
lines changed

mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c

+76-76
Large diffs are not rendered by default.

mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
#include <mruby.h>
1010
#include "mrdb.h"
1111

12-
int32_t mrb_debug_set_break_line( mrb_state *, mrb_debug_context *, const char *, uint16_t );
13-
int32_t mrb_debug_set_break_method( mrb_state *, mrb_debug_context *, const char *, const char * );
14-
int32_t mrb_debug_get_breaknum( mrb_state *, mrb_debug_context * );
15-
int32_t mrb_debug_get_break_all( mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint bp[]);
16-
int32_t mrb_debug_get_break( mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint * );
17-
int32_t mrb_debug_delete_break( mrb_state *, mrb_debug_context *, uint32_t );
18-
int32_t mrb_debug_delete_break_all( mrb_state *, mrb_debug_context * );
19-
int32_t mrb_debug_enable_break( mrb_state *, mrb_debug_context *, uint32_t );
20-
int32_t mrb_debug_enable_break_all( mrb_state *, mrb_debug_context * );
21-
int32_t mrb_debug_disable_break( mrb_state *, mrb_debug_context *, uint32_t );
22-
int32_t mrb_debug_disable_break_all( mrb_state *, mrb_debug_context * );
23-
int32_t mrb_debug_check_breakpoint_line( mrb_state *, mrb_debug_context *, const char *, uint16_t );
24-
int32_t mrb_debug_check_breakpoint_method( mrb_state *, mrb_debug_context *, struct RClass *, mrb_sym, mrb_bool* );
12+
int32_t mrb_debug_set_break_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
13+
int32_t mrb_debug_set_break_method(mrb_state *, mrb_debug_context *, const char *, const char *);
14+
int32_t mrb_debug_get_breaknum(mrb_state *, mrb_debug_context *);
15+
int32_t mrb_debug_get_break_all(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint bp[]);
16+
int32_t mrb_debug_get_break(mrb_state *, mrb_debug_context *, uint32_t, mrb_debug_breakpoint *);
17+
int32_t mrb_debug_delete_break(mrb_state *, mrb_debug_context *, uint32_t);
18+
int32_t mrb_debug_delete_break_all(mrb_state *, mrb_debug_context *);
19+
int32_t mrb_debug_enable_break(mrb_state *, mrb_debug_context *, uint32_t);
20+
int32_t mrb_debug_enable_break_all(mrb_state *, mrb_debug_context *);
21+
int32_t mrb_debug_disable_break(mrb_state *, mrb_debug_context *, uint32_t);
22+
int32_t mrb_debug_disable_break_all(mrb_state *, mrb_debug_context *);
23+
int32_t mrb_debug_check_breakpoint_line(mrb_state *, mrb_debug_context *, const char *, uint16_t);
24+
int32_t mrb_debug_check_breakpoint_method(mrb_state *, mrb_debug_context *, struct RClass *, mrb_sym, mrb_bool*);
2525

2626
#endif /* APIBREAK_H_ */

mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c

+32-32
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ parse_breakpoint_no(char* args)
7070
char* ps = args;
7171
uint32_t l;
7272

73-
if((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) {
73+
if ((*ps == '0')||(strlen(ps) >= BPNO_LETTER_NUM)) {
7474
return 0;
7575
}
7676

77-
while( !(ISBLANK(*ps)||ISCNTRL(*ps)) ) {
78-
if(!ISDIGIT(*ps)) {
77+
while (!(ISBLANK(*ps)||ISCNTRL(*ps))) {
78+
if (!ISDIGIT(*ps)) {
7979
return 0;
8080
}
8181
ps++;
@@ -90,7 +90,7 @@ exe_set_command_all(mrb_state *mrb, mrdb_state *mrdb, all_command_func func)
9090
{
9191
int32_t ret = MRB_DEBUG_OK;
9292

93-
if(mrdb->wcnt == 1) {
93+
if (mrdb->wcnt == 1) {
9494
ret = func(mrb, mrdb->dbg);
9595
print_api_common_error(ret);
9696
return TRUE;
@@ -109,15 +109,15 @@ exe_set_command_select(mrb_state *mrb, mrdb_state *mrdb, select_command_func fun
109109
for(i=1; i<mrdb->wcnt; i++) {
110110
ps = mrdb->words[i];
111111
bpno = parse_breakpoint_no(ps);
112-
if(bpno == 0) {
112+
if (bpno == 0) {
113113
printf(BREAK_ERR_MSG_INVALIDBPNO, ps);
114114
break;
115115
}
116116
ret = func(mrb, mrdb->dbg, (uint32_t)bpno);
117-
if(ret == MRB_DEBUG_BREAK_INVALID_NO) {
117+
if (ret == MRB_DEBUG_BREAK_INVALID_NO) {
118118
printf(BREAK_ERR_MSG_NOBPNO, bpno);
119119
}
120-
else if(ret != MRB_DEBUG_OK) {
120+
else if (ret != MRB_DEBUG_OK) {
121121
print_api_common_error(ret);
122122
}
123123
}
@@ -128,24 +128,24 @@ check_bptype(char* args)
128128
{
129129
char* ps = args;
130130

131-
if(ISBLANK(*ps)||ISCNTRL(*ps)) {
131+
if (ISBLANK(*ps)||ISCNTRL(*ps)) {
132132
puts(BREAK_ERR_MSG_BLANK);
133133
return MRB_DEBUG_BPTYPE_NONE;
134134
}
135135

136-
if(!ISDIGIT(*ps)) {
136+
if (!ISDIGIT(*ps)) {
137137
return MRB_DEBUG_BPTYPE_METHOD;
138138
}
139139

140-
while( !(ISBLANK(*ps)||ISCNTRL(*ps)) ) {
141-
if(!ISDIGIT(*ps)) {
140+
while (!(ISBLANK(*ps)||ISCNTRL(*ps))) {
141+
if (!ISDIGIT(*ps)) {
142142
printf(BREAK_ERR_MSG_INVALIDSTR, args);
143143
return MRB_DEBUG_BPTYPE_NONE;
144144
}
145145
ps++;
146146
}
147147

148-
if((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) {
148+
if ((*args == '0')||(strlen(args) >= LINENO_MAX_DIGIT)) {
149149
puts(BREAK_ERR_MSG_RANGEOVER);
150150
return MRB_DEBUG_BPTYPE_NONE;
151151
}
@@ -158,12 +158,12 @@ print_breakpoint(mrb_debug_breakpoint *bp)
158158
{
159159
const char* enable_letter[] = {BREAK_INFO_MSG_DISABLE, BREAK_INFO_MSG_ENABLE};
160160

161-
if(bp->type == MRB_DEBUG_BPTYPE_LINE) {
161+
if (bp->type == MRB_DEBUG_BPTYPE_LINE) {
162162
printf(BREAK_INFO_MSG_LINEBREAK,
163163
bp->bpno, enable_letter[bp->enable], bp->point.linepoint.file, bp->point.linepoint.lineno);
164164
}
165165
else {
166-
if(bp->point.methodpoint.class_name == NULL) {
166+
if (bp->point.methodpoint.class_name == NULL) {
167167
printf(BREAK_INFO_MSG_METHODBREAK_NOCLASS,
168168
bp->bpno, enable_letter[bp->enable], bp->point.methodpoint.method_name);
169169
}
@@ -183,18 +183,18 @@ info_break_all(mrb_state *mrb, mrdb_state *mrdb)
183183
mrb_debug_breakpoint *bp_list;
184184

185185
bpnum = mrb_debug_get_breaknum(mrb, mrdb->dbg);
186-
if(bpnum < 0) {
186+
if (bpnum < 0) {
187187
print_api_common_error(bpnum);
188188
return;
189189
}
190-
else if(bpnum == 0) {
190+
else if (bpnum == 0) {
191191
puts(BREAK_ERR_MSG_NOBPNO_INFOALL);
192192
return;
193193
}
194194
bp_list = (mrb_debug_breakpoint*)mrb_malloc(mrb, bpnum * sizeof(mrb_debug_breakpoint));
195195

196196
ret = mrb_debug_get_break_all(mrb, mrdb->dbg, (uint32_t)bpnum, bp_list);
197-
if(ret < 0) {
197+
if (ret < 0) {
198198
print_api_common_error(ret);
199199
return;
200200
}
@@ -219,21 +219,21 @@ info_break_select(mrb_state *mrb, mrdb_state *mrdb)
219219
for(i=2; i<mrdb->wcnt; i++) {
220220
ps = mrdb->words[i];
221221
bpno = parse_breakpoint_no(ps);
222-
if(bpno == 0) {
222+
if (bpno == 0) {
223223
puts(BREAK_ERR_MSG_INVALIDBPNO_INFO);
224224
break;
225225
}
226226

227227
ret = mrb_debug_get_break(mrb, mrdb->dbg, bpno, &bp);
228-
if(ret == MRB_DEBUG_BREAK_INVALID_NO) {
228+
if (ret == MRB_DEBUG_BREAK_INVALID_NO) {
229229
printf(BREAK_ERR_MSG_NOBPNO_INFO, bpno);
230230
break;
231231
}
232-
else if(ret != MRB_DEBUG_OK) {
232+
else if (ret != MRB_DEBUG_OK) {
233233
print_api_common_error(ret);
234234
break;
235235
}
236-
else if(isFirst == TRUE) {
236+
else if (isFirst == TRUE) {
237237
isFirst = FALSE;
238238
puts(BREAK_INFO_MSG_HEADER);
239239
}
@@ -250,17 +250,17 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c
250250
mrb_debug_bptype type;
251251
uint32_t l;
252252

253-
if(mrdb->wcnt <= 1) {
253+
if (mrdb->wcnt <= 1) {
254254
puts(BREAK_ERR_MSG_BLANK);
255255
return MRB_DEBUG_BPTYPE_NONE;
256256
}
257257

258258
args = mrdb->words[1];
259-
if((body = strrchr(args, ':')) == NULL) {
259+
if ((body = strrchr(args, ':')) == NULL) {
260260
body = args;
261261
type = check_bptype(body);
262262
} else {
263-
if(body == args) {
263+
if (body == args) {
264264
printf(BREAK_ERR_MSG_INVALIDSTR, args);
265265
return MRB_DEBUG_BPTYPE_NONE;
266266
}
@@ -271,7 +271,7 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c
271271
switch(type) {
272272
case MRB_DEBUG_BPTYPE_LINE:
273273
STRTOUL(l, body);
274-
if( l <= 65535 ) {
274+
if (l <= 65535) {
275275
*line = l;
276276
*file = (body == args)? mrb_debug_get_filename(dbg->irep, (uint32_t)(dbg->pc - dbg->irep->iseq)): args;
277277
} else {
@@ -280,17 +280,17 @@ parse_breakcommand(mrdb_state *mrdb, const char **file, uint32_t *line, char **c
280280
}
281281
break;
282282
case MRB_DEBUG_BPTYPE_METHOD:
283-
if(body == args) {
283+
if (body == args) {
284284
/* method only */
285-
if( ISUPPER(*body)||ISLOWER(*body)||(*body == '_') ) {
285+
if (ISUPPER(*body)||ISLOWER(*body)||(*body == '_')) {
286286
*method = body;
287287
*cname = NULL;
288288
} else {
289289
printf(BREAK_ERR_MSG_INVALIDMETHOD, args);
290290
type = MRB_DEBUG_BPTYPE_NONE;
291291
}
292292
} else {
293-
if( ISUPPER(*args) ) {
293+
if (ISUPPER(*args)) {
294294
switch(*body) {
295295
case '@': case '$': case '?': case '.': case ',': case ':':
296296
case ';': case '#': case '\\': case '\'': case '\"':
@@ -379,7 +379,7 @@ dbgcmd_break(mrb_state *mrb, mrdb_state *mrdb)
379379
dbgcmd_state
380380
dbgcmd_info_break(mrb_state *mrb, mrdb_state *mrdb)
381381
{
382-
if(mrdb->wcnt == 2) {
382+
if (mrdb->wcnt == 2) {
383383
info_break_all(mrb, mrdb);
384384
}
385385
else {
@@ -395,7 +395,7 @@ dbgcmd_delete(mrb_state *mrb, mrdb_state *mrdb)
395395
mrb_bool ret = FALSE;
396396

397397
ret = exe_set_command_all(mrb, mrdb, mrb_debug_delete_break_all);
398-
if(ret != TRUE) {
398+
if (ret != TRUE) {
399399
exe_set_command_select(mrb, mrdb, mrb_debug_delete_break);
400400
}
401401

@@ -408,7 +408,7 @@ dbgcmd_enable(mrb_state *mrb, mrdb_state *mrdb)
408408
mrb_bool ret = FALSE;
409409

410410
ret = exe_set_command_all(mrb, mrdb, mrb_debug_enable_break_all);
411-
if(ret != TRUE) {
411+
if (ret != TRUE) {
412412
exe_set_command_select(mrb, mrdb, mrb_debug_enable_break);
413413
}
414414

@@ -421,7 +421,7 @@ dbgcmd_disable(mrb_state *mrb, mrdb_state *mrdb)
421421
mrb_bool ret = FALSE;
422422

423423
ret = exe_set_command_all(mrb, mrdb, mrb_debug_disable_break_all);
424-
if(ret != TRUE) {
424+
if (ret != TRUE) {
425425
exe_set_command_select(mrb, mrdb, mrb_debug_disable_break);
426426
}
427427
return DBGST_PROMPT;

mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ check_cmd_pattern(const char *pattern, const char *cmd)
333333
if (pattern == NULL || cmd == NULL) {
334334
return FALSE;
335335
}
336-
if((lbracket = strchr(pattern, '[')) == NULL) {
336+
if ((lbracket = strchr(pattern, '[')) == NULL) {
337337
return !strcmp(pattern, cmd);
338338
}
339339
if ((rbracket = strchr(pattern, ']')) == NULL) {

mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ dbgcmd_run(mrb_state *mrb, mrdb_state *mrdb)
1111
{
1212
mrb_debug_context *dbg = mrdb->dbg;
1313

14-
if( dbg->xm == DBG_INIT ){
14+
if (dbg->xm == DBG_INIT){
1515
dbg->xm = DBG_RUN;
1616
} else {
1717
dbg->xm = DBG_QUIT;
18-
if( dbg->xphase == DBG_PHASE_RUNNING ){
18+
if (dbg->xphase == DBG_PHASE_RUNNING){
1919
struct RClass *exc;
2020
puts("Start it from the beginning.");
2121
exc = mrb_define_class(mrb, "DebuggerRestart", mrb_class_get(mrb, "Exception"));
@@ -32,12 +32,12 @@ dbgcmd_continue(mrb_state *mrb, mrdb_state *mrdb)
3232
mrb_debug_context *dbg = mrdb->dbg;
3333
int ccnt = 1;
3434

35-
if( mrdb->wcnt > 1 ){
35+
if (mrdb->wcnt > 1){
3636
sscanf(mrdb->words[1], "%d", &ccnt);
3737
}
3838
dbg->ccnt = (uint16_t)(ccnt > 0 ? ccnt : 1); /* count of continue */
3939

40-
if( dbg->xphase == DBG_PHASE_AFTER_RUN ){
40+
if (dbg->xphase == DBG_PHASE_AFTER_RUN){
4141
puts("The program is not running.");
4242
dbg->xm = DBG_QUIT;
4343
} else {

mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ print_info_stopped_break(mrb_state *mrb, mrdb_state *mrdb)
406406
const char *class_name;
407407

408408
ret = mrb_debug_get_break(mrb, mrdb->dbg, mrdb->dbg->stopped_bpno, &bp);
409-
if(ret == 0) {
409+
if (ret == 0) {
410410
switch(bp.type) {
411411
case MRB_DEBUG_BPTYPE_LINE:
412412
file = bp.point.linepoint.file;
@@ -416,13 +416,13 @@ print_info_stopped_break(mrb_state *mrb, mrdb_state *mrdb)
416416
case MRB_DEBUG_BPTYPE_METHOD:
417417
method_name = bp.point.methodpoint.method_name;
418418
class_name = bp.point.methodpoint.class_name;
419-
if(class_name == NULL) {
419+
if (class_name == NULL) {
420420
printf("Breakpoint %d, %s\n", bp.bpno, method_name);
421421
}
422422
else {
423423
printf("Breakpoint %d, %s:%s\n", bp.bpno, class_name, method_name);
424424
}
425-
if(mrdb->dbg->isCfunc) {
425+
if (mrdb->dbg->isCfunc) {
426426
printf("Stopped before calling the C function.\n");
427427
}
428428
break;
@@ -445,7 +445,7 @@ print_info_stopped_code(mrb_state *mrb, mrdb_state *mrdb)
445445
{
446446
char* file = mrb_debug_get_source(mrb, mrdb, mrdb->srcpath, mrdb->dbg->prvfile);
447447
uint16_t lineno = mrdb->dbg->prvline;
448-
if(file != NULL) {
448+
if (file != NULL) {
449449
mrb_debug_list(mrb, mrdb->dbg, file, lineno, lineno);
450450
mrb_free(mrb, file);
451451
}
@@ -531,9 +531,9 @@ check_method_breakpoint(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value
531531
sym = 0;
532532
break;
533533
}
534-
if(sym != 0) {
534+
if (sym != 0) {
535535
dbg->method_bpno = mrb_debug_check_breakpoint_method(mrb, dbg, c, sym, &isCfunc);
536-
if(isCfunc) {
536+
if (isCfunc) {
537537
bpno = dbg->method_bpno;
538538
dbg->method_bpno = 0;
539539
}
@@ -557,7 +557,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
557557
dbg->pc = pc;
558558
dbg->regs = regs;
559559

560-
if(dbg->xphase == DBG_PHASE_RESTART) {
560+
if (dbg->xphase == DBG_PHASE_RESTART) {
561561
dbg->root_irep = irep;
562562
dbg->prvfile = NULL;
563563
dbg->prvline = 0;
@@ -582,7 +582,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
582582
if (!file || (dbg->prvfile == file && dbg->prvline == line)) {
583583
return;
584584
}
585-
if((intptr_t)(dbg->prvci) < (intptr_t)(mrb->c->ci)) {
585+
if ((intptr_t)(dbg->prvci) < (intptr_t)(mrb->c->ci)) {
586586
return;
587587
}
588588
dbg->prvci = NULL;
@@ -623,7 +623,7 @@ mrb_code_fetch_hook(mrb_state *mrb, mrb_irep *irep, mrb_code *pc, mrb_value *reg
623623
dbg->prvfile = file;
624624
dbg->prvline = line;
625625

626-
if(dbg->bm == BRK_BREAK && --dbg->ccnt > 0) {
626+
if (dbg->bm == BRK_BREAK && --dbg->ccnt > 0) {
627627
return;
628628
}
629629
dbg->break_hook(mrb, dbg);
@@ -646,7 +646,7 @@ mrb_debug_break_hook(mrb_state *mrb, mrb_debug_context *dbg)
646646

647647
st = cmd->func(mrb, mrdb);
648648

649-
if( (st == DBGST_CONTINUE) || (st == DBGST_RESTART) ) break;
649+
if ((st == DBGST_CONTINUE) || (st == DBGST_RESTART)) break;
650650
}
651651
return dbg->xm;
652652
}
@@ -683,7 +683,7 @@ main(int argc, char **argv)
683683
mrb_assert(mrdb && mrdb->dbg);
684684
mrdb->srcpath = args.srcpath;
685685

686-
if(mrdb->dbg->xm == DBG_QUIT) {
686+
if (mrdb->dbg->xm == DBG_QUIT) {
687687
mrdb->dbg->xphase = DBG_PHASE_RESTART;
688688
}
689689
else {
@@ -750,7 +750,7 @@ main(int argc, char **argv)
750750
break;
751751
}
752752

753-
if( cmd->func(mrb, mrdb) == DBGST_RESTART ) goto l_restart;
753+
if ( cmd->func(mrb, mrdb) == DBGST_RESTART ) goto l_restart;
754754
}
755755

756756
cleanup(mrb, &args);

0 commit comments

Comments
 (0)