Drop type casting of malloc's return value. Move a memset call closer to
its corresponding malloc call.
This is a prep patch for a Coccinelle script that converts
malloc+memset(,0,) to calloc.
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
static struct null_data *null_init(struct thread_data *td)
{
- struct null_data *nd = (struct null_data *) malloc(sizeof(*nd));
+ struct null_data *nd = malloc(sizeof(*nd));
memset(nd, 0, sizeof(*nd));
if (td->o.iodepth != 1) {
- nd->io_us = (struct io_u **) malloc(td->o.iodepth * sizeof(struct io_u *));
+ nd->io_us = malloc(td->o.iodepth * sizeof(struct io_u *));
memset(nd->io_us, 0, td->o.iodepth * sizeof(struct io_u *));
td->io_ops->flags |= FIO_ASYNCIO_SETS_ISSUE_TIME;
} else
static int fio_solarisaio_init(struct thread_data *td)
{
- struct solarisaio_data *sd = malloc(sizeof(*sd));
unsigned int max_depth;
+ struct solarisaio_data *sd = malloc(sizeof(*sd));
+ memset(sd, 0, sizeof(*sd));
max_depth = td->o.iodepth;
if (max_depth > MAXASYNCHIO) {
max_depth);
}
- memset(sd, 0, sizeof(*sd));
sd->aio_events = malloc(max_depth * sizeof(struct io_u *));
memset(sd->aio_events, 0, max_depth * sizeof(struct io_u *));
sd->max_depth = max_depth;