summaryrefslogtreecommitdiff
path: root/src/helper/command.h
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 23:01:44 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:56:55 -0800
commitf973320cbb98d661bc0e4ba4fa9939ce8bce2b83 (patch)
tree9bece3c274ece8dadb15b8160f14cff3e7c6237f /src/helper/command.h
parentdeede35c270b078ae63713cfc12aa2bbc9eb78a7 (diff)
downloadopenocd+libswd-f973320cbb98d661bc0e4ba4fa9939ce8bce2b83.tar.gz
openocd+libswd-f973320cbb98d661bc0e4ba4fa9939ce8bce2b83.tar.bz2
openocd+libswd-f973320cbb98d661bc0e4ba4fa9939ce8bce2b83.tar.xz
openocd+libswd-f973320cbb98d661bc0e4ba4fa9939ce8bce2b83.zip
command_handler_t: make cmd an indirect parameter
This patch removes 'cmd' from the list of direct parameters, moving that pointer to args[-1] (by way of the new CMD_NAME macro).
Diffstat (limited to 'src/helper/command.h')
-rw-r--r--src/helper/command.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/helper/command.h b/src/helper/command.h
index fbcc0aa0..bddb053e 100644
--- a/src/helper/command.h
+++ b/src/helper/command.h
@@ -88,7 +88,7 @@ typedef struct command_context_s
*/
#define __COMMAND_HANDLER(name, extra...) \
int name(struct command_context_s *cmd_ctx, \
- const char *cmd, const char *args[], unsigned argc, ##extra)
+ const char *args[], unsigned argc, ##extra)
/**
* Use this to macro to call a command helper (or a nested handler).
@@ -104,7 +104,7 @@ typedef struct command_context_s
* variables in intervening scope(s) by accident.
*/
#define CALL_COMMAND_HANDLER(name, extra...) \
- name(cmd_ctx, cmd, args, argc, ##extra)
+ name(cmd_ctx, args, argc, ##extra)
/**
* Always use this macro to define new command handler functions.
@@ -125,7 +125,7 @@ typedef struct command_context_s
* 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
+#define CMD_NAME args[-1]
/// The type signature for commands' handler functions.