From dbb6adb1fa8e1c693d9f7c1301dde9ee3ad78084 Mon Sep 17 00:00:00 2001 From: Pawel Szewczyk Date: Thu, 21 Aug 2014 10:13:07 +0200 Subject: [PATCH] gt: Add End of commands list macro Change-Id: I6b92275ef7a73f104320d2d6e02b7c14cf06a635 Signed-off-by: Pawel Szewczyk --- source/base/include/command.h | 3 +++ source/base/src/parser.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/base/include/command.h b/source/base/include/command.h index 66d4e7b..fac4d0c 100644 --- a/source/base/include/command.h +++ b/source/base/include/command.h @@ -63,6 +63,9 @@ typedef struct command ExecutableFunc printHelp; } Command; +/* Macro indicating end of list of commands */ +#define CMD_LIST_END {NULL, AGAIN, NULL, NULL, NULL} + /** * @brief Looks for a suitable child and recursively parses it. * @details Used convention says that when string is NULL it matches diff --git a/source/base/src/parser.c b/source/base/src/parser.c index a072ff9..b0cfbf9 100644 --- a/source/base/src/parser.c +++ b/source/base/src/parser.c @@ -50,7 +50,7 @@ static inline const Command *gt_get_command_root_children(const Command *cmd) { "config", NEXT, command_parse, gt_config_get_children, gt_config_help }, { "func", NEXT, command_parse, gt_func_get_children, gt_func_help }, { NULL, AGAIN, command_parse, get_gadget_children, gt_global_help }, - { NULL, AGAIN, NULL, NULL, NULL } + CMD_LIST_END }; return commands; @@ -60,7 +60,7 @@ static inline const Command *gt_get_command_root(const Command *cmd) { static Command tool_names[] = { { NULL, NEXT, command_parse, gt_get_command_root_children, gt_global_help }, - { NULL, AGAIN, NULL, NULL, NULL } + CMD_LIST_END }; return tool_names; } -- 2.7.4