From 7de88d1bcd420447023b8e74b0aa4f5e8ba1df6b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 27 Feb 2022 16:53:22 +0100 Subject: Removed array-size constants for certain objects (steps, commands...) --- src/commands.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/commands.c') diff --git a/src/commands.c b/src/commands.c index b397878..03eded0 100644 --- a/src/commands.c +++ b/src/commands.c @@ -150,7 +150,7 @@ version_cmd = { .exec = version_exec, }; -Command *commands[NCOMMANDS] = { +Command *commands[] = { &commands_cmd, &gen_cmd, &help_cmd, @@ -164,6 +164,7 @@ Command *commands[NCOMMANDS] = { &cleanup_cmd, &unniss_cmd, &version_cmd, + NULL }; /* Other constants ***********************************************************/ @@ -336,9 +337,8 @@ help_parse_args(int c, char **v) CommandArgs *a = new_args(); if (c == 1) { - for (i = 0; i < NCOMMANDS; i++) - if (commands[i] != NULL && - !strcmp(v[0], commands[i]->name)) + for (i = 0; commands[i] != NULL; i++) + if (!strcmp(v[0], commands[i]->name)) a->command = commands[i]; if (a->command == NULL) fprintf(stderr, "%s: command not found\n", v[0]); @@ -473,7 +473,7 @@ gen_exec(CommandArgs *args) init_symcoord(); fprintf(stderr, "Generating pruning tables...\n"); - for (i = 0; i < NPTABLES && allpd[i] != NULL; i++) + for (i = 0; allpd[i] != NULL; i++) genptable(allpd[i], args->opts->nthreads); fprintf(stderr, "Done!\n"); @@ -495,7 +495,7 @@ steps_exec(CommandArgs *args) { int i; - for (i = 0; i < NSTEPS && steps[i] != NULL; i++) + for (i = 0; steps[i] != NULL; i++) printf("%-15s %s\n", steps[i]->shortname, steps[i]->name); } @@ -504,7 +504,7 @@ commands_exec(CommandArgs *args) { int i; - for (i = 0; i < NCOMMANDS && commands[i] != NULL; i++) + for (i = 0; commands[i] != NULL; i++) printf("%s\n", commands[i]->usage); } @@ -642,8 +642,8 @@ read_step(CommandArgs *args, char *str) { int i; - for (i = 0; i < NSTEPS; i++) { - if (steps[i] != NULL && !strcmp(steps[i]->shortname, str)) { + for (i = 0; steps[i] != NULL; i++) { + if (!strcmp(steps[i]->shortname, str)) { args->step = steps[i]; return true; } -- cgit v1.3