Skip to content

Commit

Permalink
initialize structs with memset()
Browse files Browse the repository at this point in the history
  • Loading branch information
akohlmey committed Mar 22, 2016
1 parent 4b58079 commit cfbbfe6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/h5md/src/ch5md.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ hid_t h5md_open_file (const char *filename)
h5md_particles_group h5md_create_particles_group(h5md_file file, const char *name)
{
h5md_particles_group group;


memset(&group,0,sizeof(group));
group.group = H5Gcreate(file.particles, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

return group;
Expand All @@ -140,7 +141,7 @@ h5md_particles_group h5md_create_particles_group(h5md_file file, const char *nam
hid_t h5md_open_particles_group(hid_t particles, const char *name)
{
hid_t group;

group = H5Gopen(particles, name, H5P_DEFAULT);

return group;
Expand All @@ -156,6 +157,7 @@ h5md_element h5md_create_time_data(hid_t loc, const char *name, int rank, int in

int i;

memset(&td,0,sizeof(td));
dims[0] = 0 ;
max_dims[0] = H5S_UNLIMITED ;
for (i=0; i<rank; i++) {
Expand Down Expand Up @@ -215,7 +217,7 @@ int h5md_close_element(h5md_element e)
H5Gclose(e.group);

return 0;

}

h5md_element h5md_create_fixed_data_simple(hid_t loc, const char *name, int rank, int int_dims[], hid_t datatype, void *data)
Expand All @@ -227,6 +229,7 @@ h5md_element h5md_create_fixed_data_simple(hid_t loc, const char *name, int rank
hsize_t dims[H5S_MAX_RANK];
int i;

memset(&fd,0,sizeof(fd));
for (i=0; i<rank; i++) {
dims[i] = int_dims[i];
}
Expand All @@ -247,9 +250,9 @@ h5md_element h5md_create_fixed_data_scalar(hid_t loc, const char *name, hid_t da
{

h5md_element fd;

hid_t spc;

memset(&fd,0,sizeof(fd));
spc = H5Screate(H5S_SCALAR);
fd.value = H5Dcreate(loc, name, datatype, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Sclose(spc);
Expand Down

0 comments on commit cfbbfe6

Please sign in to comment.