helper/command: remove unused field in struct command_registration
The field jim_handler_data in struct command_registration is never
assigned, thus has always value NULL. It was added in commit
17a9dea53a
("add jim_handler to command_registration") on Nov 23
2009, together with the homonym field jim_handler_data in struct
command, but never used since then.
Only the field jim_handler_data in struct command is used.
Remove the field from struct command_registration and use NULL
where it was referenced (or remove the assignment if the recipient
is already zero, e.g. allocated with calloc()).
Removing the field decreases the total size of OpenOCD binary by
only 4944 byte on a 64 bit x86. Not a significant improvement from
this point of view.
Change-Id: I9f1d281e3de6b2eb398e2d883c5e9ff92628aecd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5225
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
parent
e8d4074cf8
commit
90bd7d1482
|
@ -333,7 +333,6 @@ static struct command *command_new(struct command_context *cmd_ctx,
|
||||||
c->parent = parent;
|
c->parent = parent;
|
||||||
c->handler = cr->handler;
|
c->handler = cr->handler;
|
||||||
c->jim_handler = cr->jim_handler;
|
c->jim_handler = cr->jim_handler;
|
||||||
c->jim_handler_data = cr->jim_handler_data;
|
|
||||||
c->mode = cr->mode;
|
c->mode = cr->mode;
|
||||||
|
|
||||||
command_add_child(command_list_for_parent(cmd_ctx, parent), c);
|
command_add_child(command_list_for_parent(cmd_ctx, parent), c);
|
||||||
|
@ -385,7 +384,7 @@ struct command *register_command(struct command_context *context,
|
||||||
int retval = ERROR_OK;
|
int retval = ERROR_OK;
|
||||||
if (NULL != cr->jim_handler && NULL == parent) {
|
if (NULL != cr->jim_handler && NULL == parent) {
|
||||||
retval = Jim_CreateCommand(context->interp, cr->name,
|
retval = Jim_CreateCommand(context->interp, cr->name,
|
||||||
cr->jim_handler, cr->jim_handler_data, NULL);
|
cr->jim_handler, NULL, NULL);
|
||||||
} else if (NULL != cr->handler || NULL != parent)
|
} else if (NULL != cr->handler || NULL != parent)
|
||||||
retval = register_command_handler(context, command_root(c));
|
retval = register_command_handler(context, command_root(c));
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,6 @@ struct command_registration {
|
||||||
const char *name;
|
const char *name;
|
||||||
command_handler_t handler;
|
command_handler_t handler;
|
||||||
Jim_CmdProc *jim_handler;
|
Jim_CmdProc *jim_handler;
|
||||||
void *jim_handler_data;
|
|
||||||
enum command_mode mode;
|
enum command_mode mode;
|
||||||
const char *help;
|
const char *help;
|
||||||
/** a string listing the options and arguments, required or optional */
|
/** a string listing the options and arguments, required or optional */
|
||||||
|
|
Loading…
Reference in New Issue