diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-02-10 00:49:27 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-02-10 00:49:27 +0000 |
commit | 551464706c848526646a20b5b4172cda69f0e005 (patch) | |
tree | 44d39aead773aca821fcb51bd2ce18372ba99d10 /src/commands.c | |
parent | a306cd551640286eb1ad189e87bf7815b5a94de8 (diff) | |
download | imv-551464706c848526646a20b5b4172cda69f0e005.tar.gz |
Tweak allocation sizeof operator usage
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commands.c b/src/commands.c index 0fb8b46..ca40244 100644 --- a/src/commands.c +++ b/src/commands.c @@ -9,7 +9,7 @@ struct command { struct imv_commands *imv_commands_create(void) { - struct imv_commands *cmds = malloc(sizeof(struct imv_commands)); + struct imv_commands *cmds = malloc(sizeof *cmds); cmds->command_list = list_create(); return cmds; } @@ -30,7 +30,7 @@ void imv_commands_free(struct imv_commands *cmds) void imv_command_register(struct imv_commands *cmds, const char *command, void (*handler)(struct list*, const char*, void*)) { - struct command *cmd = malloc(sizeof(struct command)); + struct command *cmd = malloc(sizeof *cmd); cmd->command = strdup(command); cmd->handler = handler; cmd->alias = NULL; @@ -39,7 +39,7 @@ void imv_command_register(struct imv_commands *cmds, const char *command, void ( void imv_command_alias(struct imv_commands *cmds, const char *command, const char *alias) { - struct command *cmd = malloc(sizeof(struct command)); + struct command *cmd = malloc(sizeof *cmd); cmd->command = strdup(command); cmd->handler = NULL; cmd->alias = strdup(alias); |