Remove unnecessary define for keeping track of string array size

This commit is contained in:
jfreegman 2021-12-15 13:39:11 -05:00
parent f91d10c831
commit b6f892edf5
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
1 changed files with 3 additions and 9 deletions

View File

@ -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;
}