Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
0d4b43e5
Commit
0d4b43e5
authored
Mar 01, 2018
by
Matthieu Schaller
Browse files
Add explicit casts after malloc() in the cosmology section of the code.
parent
30c5a76c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cosmology.c
View file @
0d4b43e5
...
...
@@ -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
=
...
...
src/engine.c
View file @
0d4b43e5
...
...
@@ -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
;
...
...
src/parallel_io.c
View file @
0d4b43e5
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment