diff --git a/src/interpreter.c b/src/interpreter.c index 4e13692..6fd49b5 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -24,9 +24,7 @@ #include "networking.h" #include "main.h" -#define IS_SPACE(c) (g_ascii_isspace((c)) || (!(c))) - -WMUD_COMMAND(gcmd_quit); +WMUD_COMMAND(quit); static wmudCommand command_list[] = { { "quit", gcmd_quit }, @@ -87,7 +85,7 @@ wmud_interpret_game_command(wmudClient *client) start++; break; } - else if (!IS_SPACE(*start)) + else if (g_ascii_isspace(*start) || (!*start)) { break; } diff --git a/src/interpreter.h b/src/interpreter.h index 8f42b57..e96147a 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -30,7 +30,13 @@ * Command handler function type */ typedef void (*wmudCommandFunc)(wmudClient *client, gchar *command, GSList *token_list); -#define WMUD_COMMAND(name) void name(wmudClient *client, gchar *command, GSList *token_list) +/** + * WMUD_COMMAND: + * @name: the name of the command. Should be in lowercase + * + * Shorthand to create the function header for command handlers + */ +#define WMUD_COMMAND(name) void gcmd_ ## name(wmudClient *client, gchar *command, GSList *token_list) /** * wmudCommand: