From 88342f8b3f8658bf82ce5d25d5597f237f23c544 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 21 Aug 2020 09:50:49 -0500 Subject: Use the safe calloc() idiom, p = calloc(1, sizeof(*p)), and do not gratuitously cast to p's type. --- test/vfd_swmr_addrem_writer.c | 2 +- test/vfd_swmr_generator.c | 2 +- test/vfd_swmr_remove_reader.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/vfd_swmr_addrem_writer.c b/test/vfd_swmr_addrem_writer.c index 51b2470..2b93926 100644 --- a/test/vfd_swmr_addrem_writer.c +++ b/test/vfd_swmr_addrem_writer.c @@ -107,7 +107,7 @@ open_skeleton(const char *filename, unsigned verbose) goto error; /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)calloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) + if((config = calloc(1, sizeof(*config))) == NULL) goto error; config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; diff --git a/test/vfd_swmr_generator.c b/test/vfd_swmr_generator.c index 13fc941..35a1ac5 100644 --- a/test/vfd_swmr_generator.c +++ b/test/vfd_swmr_generator.c @@ -144,7 +144,7 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, return -1; /* Allocate memory for the VFD SWMR configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) + if((config = HDcalloc(1, sizeof(*config))) == NULL) return -1; config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; diff --git a/test/vfd_swmr_remove_reader.c b/test/vfd_swmr_remove_reader.c index c7689c0..f56fce3 100644 --- a/test/vfd_swmr_remove_reader.c +++ b/test/vfd_swmr_remove_reader.c @@ -309,7 +309,7 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, goto error; /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) + if((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; -- cgit v0.12