diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/gen_filespace.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'test/gen_filespace.c')
-rw-r--r-- | test/gen_filespace.c | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/test/gen_filespace.c b/test/gen_filespace.c index bf49b7b..3803628 100644 --- a/test/gen_filespace.c +++ b/test/gen_filespace.c @@ -14,21 +14,21 @@ #include "hdf5.h" #include <assert.h> -#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ +#define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */ const char *FILENAMES[] = { - "fsm_aggr_nopersist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + not persisting free-space */ - "fsm_aggr_persist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + persisting free-space */ - "paged_nopersist.h5", /* H5F_FSPACE_STRATEGY_PAGE + not persisting free-space */ - "paged_persist.h5", /* H5F_FSPACE_STRATEGY_PAGE + persisting free-space */ - "aggr.h5", /* H5F_FSPACE_STRATEGY_AGGR */ - "none.h5" /* H5F_FSPACE_STRATEGY_NONE */ + "fsm_aggr_nopersist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + not persisting free-space */ + "fsm_aggr_persist.h5", /* H5F_FSPACE_STRATEGY_FSM_AGGR + persisting free-space */ + "paged_nopersist.h5", /* H5F_FSPACE_STRATEGY_PAGE + not persisting free-space */ + "paged_persist.h5", /* H5F_FSPACE_STRATEGY_PAGE + persisting free-space */ + "aggr.h5", /* H5F_FSPACE_STRATEGY_AGGR */ + "none.h5" /* H5F_FSPACE_STRATEGY_NONE */ }; -#define DATASET "dset" -#define NUM_ELMTS 100 -#define FALSE 0 -#define TRUE 1 +#define DATASET "dset" +#define NUM_ELMTS 100 +#define FALSE 0 +#define TRUE 1 /* * Compile and run this program in the trunk to generate @@ -44,58 +44,61 @@ const char *FILENAMES[] = { * compatibility testing via test_filespace_round_compatible() in test/tfile.c. * */ -int main(void) +int +main(void) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hsize_t dim[1]; /* Dimension sizes */ - int data[NUM_ELMTS]; /* Buffer for data */ - int i, j; /* Local index variables */ - H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ - unsigned fs_persist; /* Persisting free-space or not */ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hsize_t dim[1]; /* Dimension sizes */ + int data[NUM_ELMTS]; /* Buffer for data */ + int i, j; /* Local index variables */ + H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ + unsigned fs_persist; /* Persisting free-space or not */ j = 0; - for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) { - for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { + for (fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; + fs_strategy++) { + for (fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { - if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR) + if (fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR) continue; /* Get a copy of the default file creation property */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; - if(H5Pset_file_space_strategy(fcpl, fs_strategy, fs_persist, (hsize_t)1) < 0) + if (H5Pset_file_space_strategy(fcpl, fs_strategy, fs_persist, (hsize_t)1) < 0) goto error; /* Create the file with the file space info */ - if((fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create the dataset */ dim[0] = NUM_ELMTS; - if((sid = H5Screate_simple(1, dim, NULL)) < 0) + if ((sid = H5Screate_simple(1, dim, NULL)) < 0) goto error; - if((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < + 0) goto error; - for(i = 0; i < NUM_ELMTS; i++) + for (i = 0; i < NUM_ELMTS; i++) data[i] = i; /* Write the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Closing */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) goto error; - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) goto error; - if(H5Fclose(fid) < 0) + if (H5Fclose(fid) < 0) goto error; - if(H5Pclose(fcpl) < 0) + if (H5Pclose(fcpl) < 0) goto error; ++j; } @@ -105,11 +108,13 @@ int main(void) return 0; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Sclose(sid); H5Sclose(did); H5Pclose(fcpl); H5Fclose(fid); - } H5E_END_TRY; + } + H5E_END_TRY; return -1; } |