Skip to content

Commit b3171fb

Browse files
committed
Syntax change to finally use a switch case somewhere :)
1 parent f304d61 commit b3171fb

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

main.c

+8-11
Original file line numberDiff line numberDiff line change
@@ -485,23 +485,20 @@ char* append_string(char **dest, const char *src) {
485485

486486
int main(int argc, char **argv)
487487
{
488-
int app;
489-
490488
printf ("model-ghdl revision %s, compiled on %s.\n", PROGRAM_REVISION, __DATE__);
491489

492-
app = get_application(argv[0]);
493-
494-
if (app == PROG_VCOM) {
490+
switch (get_application(argv[0])) {
491+
case PROG_VCOM:
495492
return vcom(argc, argv);
496-
}
497-
else if (app == PROG_VSIM) {
493+
case PROG_VSIM:
498494
return vsim(argc, argv);
499-
}
500-
else if (app == PROG_VMAP || app == PROG_VLIB || app == PROG_VDEL) {
495+
case PROG_VMAP:
496+
case PROG_VLIB:
497+
case PROG_VDEL:
501498
return 0;
499+
default:
500+
return 255;
502501
}
503-
504-
return 255;
505502
}
506503

507504
// Detects which function to call depending on the program name in argv[0]

0 commit comments

Comments
 (0)