From 551464706c848526646a20b5b4172cda69f0e005 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sun, 10 Feb 2019 00:49:27 +0000 Subject: Tweak allocation sizeof operator usage --- src/commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/commands.c') 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); -- cgit v1.2.3