gt: Add End of commands list macro
authorPawel Szewczyk <p.szewczyk@samsung.com>
Thu, 21 Aug 2014 08:13:07 +0000 (10:13 +0200)
committerKrzysztof Opasiak <kopasiak90@gmail.com>
Wed, 27 Aug 2014 10:14:37 +0000 (12:14 +0200)
Change-Id: I6b92275ef7a73f104320d2d6e02b7c14cf06a635
Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
source/base/include/command.h
source/base/src/parser.c

index 66d4e7b..fac4d0c 100644 (file)
@@ -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
index a072ff9..b0cfbf9 100644 (file)
@@ -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;
 }