add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites.
This commit is contained in:
@@ -121,6 +121,12 @@ typedef struct command_context_s
|
||||
*/
|
||||
#define COMMAND_HELPER(name, extra...) __COMMAND_HANDLER(name, extra)
|
||||
|
||||
/**
|
||||
* Use this macro to access the name of the command being handled,
|
||||
* rather than accessing the variable directly. It may be moved.
|
||||
*/
|
||||
#define CMD_NAME cmd
|
||||
|
||||
|
||||
/// The type signature for commands' handler functions.
|
||||
typedef __COMMAND_HANDLER((*command_handler_t));
|
||||
|
||||
Reference in New Issue
Block a user