- uint32_t old_size = i * sizeof(struct Command);
- uint32_t new_size = old_size + sizeof(struct Command);
- struct Command * new_cmds = try_malloc(new_size, f_name);
- memcpy(new_cmds, world.commandDB.cmds, old_size);
- new_cmds[i] = cmd;
- free(world.commandDB.cmds);
- world.commandDB.cmds = new_cmds;
+ array_append(i, sizeof(struct Command), (void *) &cmd,
+ (void **) &world.commandDB.cmds);