From b6f892edf51e9098af0eea7ef297f7d141dc13c8 Mon Sep 17 00:00:00 2001 From: jfreegman Date: Wed, 15 Dec 2021 13:39:11 -0500 Subject: [PATCH] Remove unnecessary define for keeping track of string array size --- src/execute.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/execute.c b/src/execute.c index 12baa85..f285a9f 100644 --- a/src/execute.c +++ b/src/execute.c @@ -117,15 +117,8 @@ static struct cmd_func conference_commands[] = { { NULL, NULL }, }; - -#ifdef PYTHON -#define SPECIAL_COMMANDS 8 -#else -#define SPECIAL_COMMANDS 7 -#endif /* PYTHON */ - /* Special commands are commands that only take one argument even if it contains spaces */ -static const char special_commands[SPECIAL_COMMANDS][MAX_CMDNAME_SIZE] = { +static const char special_commands[][MAX_CMDNAME_SIZE] = { "/add", "/avatar", "/nick", @@ -136,6 +129,7 @@ static const char special_commands[SPECIAL_COMMANDS][MAX_CMDNAME_SIZE] = { "/sendfile", "/title", "/mute", + "", }; /* Returns true if input command is in the special_commands array. */ @@ -143,7 +137,7 @@ static bool is_special_command(const char *input) { const int s = char_find(0, input, ' '); - for (int i = 0; i < SPECIAL_COMMANDS; ++i) { + for (int i = 0; special_commands[i][0] != '\0'; ++i) { if (strncmp(input, special_commands[i], s) == 0) { return true; }