Commit 0d4b43e5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add explicit casts after malloc() in the cosmology section of the code.

parent 30c5a76c
......@@ -290,12 +290,14 @@ void cosmology_init_tables(struct cosmology *c) {
const double a_begin = c->a_begin;
/* Allocate memory for the interpolation tables */
c->drift_fac_interp_table = malloc(cosmology_table_length * sizeof(double));
c->drift_fac_interp_table =
(double *)malloc(cosmology_table_length * sizeof(double));
c->grav_kick_fac_interp_table =
malloc(cosmology_table_length * sizeof(double));
(double *)malloc(cosmology_table_length * sizeof(double));
c->hydro_kick_fac_interp_table =
malloc(cosmology_table_length * sizeof(double));
c->time_interp_table = malloc(cosmology_table_length * sizeof(double));
(double *)malloc(cosmology_table_length * sizeof(double));
c->time_interp_table =
(double *)malloc(cosmology_table_length * sizeof(double));
/* Prepare a table of scale factors for the integral bounds */
const double delta_a =
......
......@@ -5917,7 +5917,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
units_struct_restore(us, stream);
e->snapshotUnits = us;
struct cosmology *cosmo = malloc(sizeof(struct cosmology));
struct cosmology *cosmo =
(struct cosmology *)malloc(sizeof(struct cosmology));
cosmology_struct_restore(cosmo, stream);
e->cosmology = cosmo;
......@@ -5954,7 +5955,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
cooling_struct_restore(cooling_func, stream);
e->cooling_func = cooling_func;
struct chemistry_data *chemistry = malloc(sizeof(struct chemistry_data));
struct chemistry_data *chemistry =
(struct chemistry_data *)malloc(sizeof(struct chemistry_data));
chemistry_struct_restore(chemistry, stream);
e->chemistry = chemistry;
......
......@@ -931,10 +931,9 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
/* Print the gravity parameters */
if (e->policy & engine_policy_cosmology) {
h_grp = H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
if (h_grp < 0)
error("Error while creating cosmology group");
h_grp =
H5Gcreate(h_file, "/Cosmology", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (h_grp < 0) error("Error while creating cosmology group");
cosmology_write_model(h_grp, e->cosmology);
H5Gclose(h_grp);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment