diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-03-25 00:39:37 (GMT) |
commit | feb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch) | |
tree | e15d7e751af4e3c42e77ea955d91db4cf27a71cf /test/vfd_swmr_reader.c | |
parent | bdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff) | |
download | hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2 |
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'test/vfd_swmr_reader.c')
-rw-r--r-- | test/vfd_swmr_reader.c | 315 |
1 files changed, 155 insertions, 160 deletions
diff --git a/test/vfd_swmr_reader.c b/test/vfd_swmr_reader.c index 111d37c..4fb36b3 100644 --- a/test/vfd_swmr_reader.c +++ b/test/vfd_swmr_reader.c @@ -39,19 +39,17 @@ /* Local Prototypes */ /********************/ -static int check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, - const char *sym_name, symbol_t *record, hid_t rec_sid); -static int read_records(const char *filename, hbool_t verbose, FILE *verbose_file, - unsigned random_seed, unsigned long nseconds, unsigned poll_time, - unsigned ncommon, unsigned nrandom); +static int check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, const char *sym_name, + symbol_t *record, hid_t rec_sid); +static int read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed, + unsigned long nseconds, unsigned poll_time, unsigned ncommon, unsigned nrandom); /*******************/ /* Local Variables */ /*******************/ -static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */ +static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */ - /*------------------------------------------------------------------------- * Function: check_dataset * @@ -85,16 +83,16 @@ static hid_t symbol_tid = -1; /* The type ID for the SWMR datasets */ *------------------------------------------------------------------------- */ static int -check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, - const char *sym_name, symbol_t *record, hid_t rec_sid) +check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, const char *sym_name, symbol_t *record, + hid_t rec_sid) { - int fill_count = 0; /* # of times fill value (0) was read - * instead of the expected value. - */ - hid_t dsid = H5I_INVALID_HID; /* Dataset ID */ - hid_t file_sid = H5I_INVALID_HID; /* Dataset's space ID */ - hssize_t snpoints; /* Number of elements in dataset */ - hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */ + int fill_count = 0; /* # of times fill value (0) was read + * instead of the expected value. + */ + hid_t dsid = H5I_INVALID_HID; /* Dataset ID */ + hid_t file_sid = H5I_INVALID_HID; /* Dataset's space ID */ + hssize_t snpoints; /* Number of elements in dataset */ + hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */ HDassert(fid >= 0); HDassert(sym_name); @@ -102,41 +100,40 @@ check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, HDassert(rec_sid >= 0); /* Open dataset for symbol */ - if((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0) { + if ((dsid = H5Dopen2(fid, sym_name, H5P_DEFAULT)) < 0) { fprintf(stderr, "%s.%d: H5Dopen2 failed\n", __func__, __LINE__); goto error; } /* Get the dataset's dataspace */ - if((file_sid = H5Dget_space(dsid)) < 0) { + if ((file_sid = H5Dget_space(dsid)) < 0) { fprintf(stderr, "%s.%d: H5Dget_space failed\n", __func__, __LINE__); goto error; } /* Get the number of elements (= records, for 1-D datasets) */ - if((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0) { - fprintf(stderr, "%s.%d: H5Sget_simple_extent_npoints failed\n", - __func__, __LINE__); + if ((snpoints = H5Sget_simple_extent_npoints(file_sid)) < 0) { + fprintf(stderr, "%s.%d: H5Sget_simple_extent_npoints failed\n", __func__, __LINE__); goto error; } /* Emit informational message */ - if(verbose) - HDfprintf(verbose_file, "READER: Symbol = '%s', # of records = %lld\n", sym_name, (long long)snpoints); + if (verbose) + HDfprintf(verbose_file, "READER: Symbol = '%s', # of records = %lld\n", sym_name, + (long long)snpoints); /* Check if there are records for symbol */ - if(snpoints > 0) { + if (snpoints > 0) { /* Choose the last record in the dataset */ start[1] = (hsize_t)(snpoints - 1); - if(H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { - fprintf(stderr, "%s.%d: H5Sselect_hyperslab failed\n", - __func__, __LINE__); + if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { + fprintf(stderr, "%s.%d: H5Sselect_hyperslab failed\n", __func__, __LINE__); goto error; } /* Read record from dataset */ record->rec_id = UINT64_MAX; - if(H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0) { + if (H5Dread(dsid, symbol_tid, rec_sid, file_sid, H5P_DEFAULT, record) < 0) { fprintf(stderr, "%s.%d: H5Dread failed\n", __func__, __LINE__); goto error; } @@ -149,31 +146,28 @@ check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, HDgettimeofday(&tv, NULL); - if(verbose) { + if (verbose) { HDfprintf(verbose_file, "*** READER ERROR ***\n"); HDfprintf(verbose_file, "Incorrect record value!\n"); HDfprintf(verbose_file, - "Time = %jd.%06jd, Symbol = '%s'" - ", # of records = %" PRIdHSIZE - ", record->rec_id = %" PRIu64 "\n", - (intmax_t)tv.tv_sec, (intmax_t)tv.tv_usec, - sym_name, snpoints, record->rec_id); + "Time = %jd.%06jd, Symbol = '%s'" + ", # of records = %" PRIdHSIZE ", record->rec_id = %" PRIu64 "\n", + (intmax_t)tv.tv_sec, (intmax_t)tv.tv_usec, sym_name, snpoints, record->rec_id); } /* end if */ - fprintf(stderr, - "%s.%d: record value %" PRIu64 " != %" PRIuHSIZE "\n", - __func__, __LINE__, record->rec_id, start[1]); + fprintf(stderr, "%s.%d: record value %" PRIu64 " != %" PRIuHSIZE "\n", __func__, __LINE__, + record->rec_id, start[1]); goto error; } /* end if */ - } /* end if */ + } /* end if */ /* Close the dataset's dataspace */ - if(H5Sclose(file_sid) < 0) { + if (H5Sclose(file_sid) < 0) { fprintf(stderr, "%s.%d: H5Sclose failed\n", __func__, __LINE__); goto error; } /* Close dataset for symbol */ - if(H5Dclose(dsid) < 0) { + if (H5Dclose(dsid) < 0) { fprintf(stderr, "%s.%d: H5Dclose failed\n", __func__, __LINE__); goto error; } @@ -181,15 +175,16 @@ check_dataset(hid_t fid, hbool_t verbose, FILE *verbose_file, return fill_count; error: - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Sclose(file_sid); H5Dclose(dsid); - } H5E_END_TRY; + } + H5E_END_TRY; return -1; } /* end check_dataset() */ - /*------------------------------------------------------------------------- * Function: read_records * @@ -232,21 +227,20 @@ error: *------------------------------------------------------------------------- */ static int -read_records(const char *filename, hbool_t verbose, FILE *verbose_file, - unsigned random_seed, unsigned long nseconds, unsigned poll_time, - unsigned ncommon, unsigned nrandom) +read_records(const char *filename, hbool_t verbose, FILE *verbose_file, unsigned random_seed, + unsigned long nseconds, unsigned poll_time, unsigned ncommon, unsigned nrandom) { - time_t start_time; /* Starting time */ - time_t curr_time; /* Current time */ - symbol_info_t **sym_com = NULL; /* Pointers to array of common dataset IDs */ - symbol_info_t **sym_rand = NULL; /* Pointers to array of random dataset IDs */ - hid_t mem_sid = H5I_INVALID_HID; /* Memory dataspace ID */ - hid_t fid = H5I_INVALID_HID; /* SWMR test file ID */ - hid_t fapl = H5I_INVALID_HID; /* file access property list */ - symbol_t record; /* The record to read from the dataset */ - unsigned v; /* Local index variable */ - hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */ - H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */ + time_t start_time; /* Starting time */ + time_t curr_time; /* Current time */ + symbol_info_t ** sym_com = NULL; /* Pointers to array of common dataset IDs */ + symbol_info_t ** sym_rand = NULL; /* Pointers to array of random dataset IDs */ + hid_t mem_sid = H5I_INVALID_HID; /* Memory dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* SWMR test file ID */ + hid_t fapl = H5I_INVALID_HID; /* file access property list */ + symbol_t record; /* The record to read from the dataset */ + unsigned v; /* Local index variable */ + hbool_t use_log_vfd = FALSE; /* Use the log VFD (set this manually) */ + H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */ HDassert(filename); HDassert(nseconds != 0); @@ -257,86 +251,86 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, HDmemset(&record, 0, sizeof(record)); /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Choosing datasets\n"); /* Allocate space for 'common' datasets, if any */ - if(ncommon > 0) { + if (ncommon > 0) { /* Allocate array to hold pointers to symbols for common datasets */ - if(NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon))) { + if (NULL == (sym_com = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * ncommon))) { fprintf(stderr, "%s.%d: malloc failed\n", __func__, __LINE__); goto error; } /* Open the common datasets */ - for(v = 0; v < ncommon; v++) { - unsigned offset; /* Offset of symbol to use */ + for (v = 0; v < ncommon; v++) { + unsigned offset; /* Offset of symbol to use */ /* Determine the offset of the symbol, within level 0 symbols */ /* (level 0 symbols are the most common symbols) */ - offset = (unsigned)((unsigned)HDrandom() % symbol_count[0]); + offset = (unsigned)((unsigned)HDrandom() % symbol_count[0]); sym_com[v] = &symbol_info[0][offset]; /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Common symbol #%u = '%s'\n", v, symbol_info[0][offset].name); } /* end for */ - } /* end if */ + } /* end if */ /* Allocate space for 'random' datasets, if any */ - if(nrandom > 0) { + if (nrandom > 0) { /* Allocate array to hold pointers to symbols for random datasets */ - if(NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom))) { + if (NULL == (sym_rand = (symbol_info_t **)HDmalloc(sizeof(symbol_info_t *) * nrandom))) { fprintf(stderr, "%s.%d: malloc failed\n", __func__, __LINE__); goto error; } /* Determine the random datasets */ - for(v = 0; v < nrandom; v++) { - symbol_info_t *sym; /* Symbol to use */ + for (v = 0; v < nrandom; v++) { + symbol_info_t *sym; /* Symbol to use */ /* Determine the symbol, within all symbols */ - if(NULL == (sym = choose_dataset(NULL, NULL))) + if (NULL == (sym = choose_dataset(NULL, NULL))) return -1; sym_rand[v] = sym; /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Random symbol #%u = '%s'\n", v, sym->name); } /* end for */ - } /* end if */ + } /* end if */ /* Create a dataspace for the record to read */ - if((mem_sid = H5Screate(H5S_SCALAR)) < 0) { + if ((mem_sid = H5Screate(H5S_SCALAR)) < 0) { fprintf(stderr, "%s.%d: H5Screate failed\n", __func__, __LINE__); goto error; } /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Going to open file and read records\n"); /* Get the starting time */ start_time = HDtime(NULL); - curr_time = start_time; + curr_time = start_time; /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) { + if ((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) { fprintf(stderr, "%s.%d: malloc failed\n", __func__, __LINE__); goto error; } /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ - init_vfd_swmr_config(config, 4, 5 , FALSE, FALSE, 128, "./rw-shadow"); + init_vfd_swmr_config(config, 4, 5, FALSE, FALSE, 128, "./rw-shadow"); /* use_latest_format, use_vfd_swmr, only_meta_page, config */ - if((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, config)) < 0) { + if ((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, config)) < 0) { fprintf(stderr, "%s.%d: vfd_swmr_create_fapl failed\n", __func__, __LINE__); goto error; } /* Log I/O when verbose output it enbabled */ - if(use_log_vfd) { + if (use_log_vfd) { char verbose_name[1024]; HDsnprintf(verbose_name, sizeof(verbose_name), "vfd_swmr_reader.log.%u", random_seed); @@ -345,77 +339,74 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, } /* end if */ /* Loop over reading records until [at least] the correct # of seconds have passed */ - while(curr_time < (time_t)(start_time + (time_t)nseconds)) { + while (curr_time < (time_t)(start_time + (time_t)nseconds)) { /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Opening file: %s\n", filename); /* Open the file with VFD SWMR configured */ /* Remove H5E_BEGIN_TRY/END_TRY if you want to see the error stack */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); - } H5E_END_TRY; - if(fid < 0) { + } + H5E_END_TRY; + if (fid < 0) { HDfprintf(stderr, "READER: Error in opening the file: %s\n", filename); goto error; } /* Check 'common' datasets, if any */ - if(ncommon > 0) { + if (ncommon > 0) { /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Checking common symbols after FILE OPEN\n"); /* Iterate over common datasets */ - for(v = 0; v < ncommon; v++) { + for (v = 0; v < ncommon; v++) { /* Check common dataset */ const int fill_count = - check_dataset(fid, verbose, verbose_file, sym_com[v]->name, - &record, mem_sid); - if(fill_count < 0) { - fprintf(stderr, "%s.%d: check_dataset failed\n", - __func__, __LINE__); + check_dataset(fid, verbose, verbose_file, sym_com[v]->name, &record, mem_sid); + if (fill_count < 0) { + fprintf(stderr, "%s.%d: check_dataset failed\n", __func__, __LINE__); goto error; } HDmemset(&record, 0, sizeof(record)); if (fill_count > 0) { - fprintf(stderr, "common dataset: read fill at %d records\n", - fill_count); + fprintf(stderr, "common dataset: read fill at %d records\n", fill_count); } } /* end for */ - } /* end if */ + } /* end if */ /* Check 'random' datasets, if any */ - if(nrandom > 0) { + if (nrandom > 0) { /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Checking random symbols after FILE OPEN\n"); /* Iterate over random datasets */ - for(v = 0; v < nrandom; v++) { + for (v = 0; v < nrandom; v++) { /* Check random dataset */ - const int fill_count = check_dataset(fid, verbose, verbose_file, - sym_rand[v]->name, &record, mem_sid); - if(fill_count < 0) { - fprintf(stderr, "%s.%d: check_dataset failed\n", - __func__, __LINE__); + const int fill_count = + check_dataset(fid, verbose, verbose_file, sym_rand[v]->name, &record, mem_sid); + if (fill_count < 0) { + fprintf(stderr, "%s.%d: check_dataset failed\n", __func__, __LINE__); goto error; } HDmemset(&record, 0, sizeof(record)); if (fill_count > 0) { - fprintf(stderr, "random dataset: read fill at %d records\n", - fill_count); + fprintf(stderr, "random dataset: read fill at %d records\n", fill_count); } } /* end for */ - } /* end if */ + } /* end if */ /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Closing file\n"); - + /* Close the file */ - if(H5Fclose(fid) < 0) { + if (H5Fclose(fid) < 0) { fprintf(stderr, "%s.%d: H5Fclose failed\n", __func__, __LINE__); goto error; } @@ -428,32 +419,32 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, } /* end while */ /* Close the memory dataspace */ - if(H5Sclose(mem_sid) < 0) { + if (H5Sclose(mem_sid) < 0) { fprintf(stderr, "%s.%d: H5Sclose failed\n", __func__, __LINE__); goto error; } /* Close the fapl */ - if(H5Pclose(fapl) < 0) { + if (H5Pclose(fapl) < 0) { fprintf(stderr, "%s.%d: H5Pclose failed\n", __func__, __LINE__); goto error; } - if(config) + if (config) HDfree(config); /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Closing datasets\n"); /* Close 'random' datasets, if any */ - if(nrandom > 0) { + if (nrandom > 0) { /* Release array holding dataset ID's for random datasets */ HDfree(sym_rand); } /* end if */ /* Close 'common' datasets, if any */ - if(ncommon > 0) { + if (ncommon > 0) { /* Release array holding dataset ID's for common datasets */ HDfree(sym_com); } /* end if */ @@ -461,20 +452,22 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, return 0; error: - if(config) + if (config) HDfree(config); - if(sym_rand) + if (sym_rand) HDfree(sym_rand); - if(sym_com) + if (sym_com) HDfree(sym_com); - H5E_BEGIN_TRY { + H5E_BEGIN_TRY + { H5Sclose(mem_sid); H5Fclose(fid); H5Pclose(fapl); - } H5E_END_TRY; + } + H5E_END_TRY; return -1; } /* end read_records() */ @@ -498,31 +491,32 @@ usage(void) HDexit(1); } -int main(int argc, const char *argv[]) +int +main(int argc, const char *argv[]) { - long nseconds = 0; /* # of seconds to test */ - int poll_time = 1; /* # of seconds between polling */ - int ncommon = 5; /* # of common symbols to poll */ - int nrandom = 10; /* # of random symbols to poll */ - hbool_t verbose = TRUE; /* Whether to emit some informational messages */ - FILE *verbose_file = NULL; /* File handle for verbose output */ - hbool_t use_seed = FALSE; /* Set to 1 if a seed was set on the command line */ - unsigned random_seed = 0; /* Random # seed */ - unsigned u; /* Local index variables */ - int temp; + long nseconds = 0; /* # of seconds to test */ + int poll_time = 1; /* # of seconds between polling */ + int ncommon = 5; /* # of common symbols to poll */ + int nrandom = 10; /* # of random symbols to poll */ + hbool_t verbose = TRUE; /* Whether to emit some informational messages */ + FILE * verbose_file = NULL; /* File handle for verbose output */ + hbool_t use_seed = FALSE; /* Set to 1 if a seed was set on the command line */ + unsigned random_seed = 0; /* Random # seed */ + unsigned u; /* Local index variables */ + int temp; /* Parse command line options */ - if(argc < 2) + if (argc < 2) usage(); - if(argc > 1) { + if (argc > 1) { u = 1; - while(u < (unsigned)argc) { - if(argv[u][0] == '-') { - switch(argv[u][1]) { + while (u < (unsigned)argc) { + if (argv[u][0] == '-') { + switch (argv[u][1]) { /* # of common symbols to poll */ case 'h': ncommon = HDatoi(argv[u + 1]); - if(ncommon < 0) + if (ncommon < 0) usage(); u += 2; break; @@ -530,7 +524,7 @@ int main(int argc, const char *argv[]) /* # of random symbols to poll */ case 'l': nrandom = HDatoi(argv[u + 1]); - if(nrandom < 0) + if (nrandom < 0) usage(); u += 2; break; @@ -544,8 +538,8 @@ int main(int argc, const char *argv[]) /* Random # seed */ case 'r': use_seed = TRUE; - temp = HDatoi(argv[u + 1]); - if(temp < 0) + temp = HDatoi(argv[u + 1]); + if (temp < 0) usage(); else random_seed = (unsigned)temp; @@ -555,7 +549,7 @@ int main(int argc, const char *argv[]) /* # of seconds between polling */ case 's': poll_time = HDatoi(argv[u + 1]); - if(poll_time < 0) + if (poll_time < 0) usage(); u += 2; break; @@ -564,24 +558,24 @@ int main(int argc, const char *argv[]) usage(); break; } /* end switch */ - } /* end if */ + } /* end if */ else { /* Get the number of records to append */ nseconds = HDatol(argv[u]); - if(nseconds <= 0) + if (nseconds <= 0) usage(); u++; } /* end else */ - } /* end while */ - } /* end if */ - if(nseconds <= 0) + } /* end while */ + } /* end if */ + if (nseconds <= 0) usage(); - if(poll_time >= nseconds) + if (poll_time >= nseconds) usage(); /* Set the random seed */ - if(!use_seed) { + if (!use_seed) { struct timeval t; HDgettimeofday(&t, NULL); @@ -590,18 +584,18 @@ int main(int argc, const char *argv[]) HDsrandom(random_seed); /* Open output file */ - if(verbose) { + if (verbose) { char verbose_name[1024]; HDsnprintf(verbose_name, sizeof(verbose_name), "vfd_swmr_reader.out.%u", random_seed); - if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) { + if (NULL == (verbose_file = HDfopen(verbose_name, "w"))) { HDfprintf(stderr, "READER: Can't open verbose output file!\n"); HDexit(1); } } /* end if */ /* Emit informational message */ - if(verbose) { + if (verbose) { HDfprintf(verbose_file, "READER: Parameters:\n"); HDfprintf(verbose_file, "\t# of seconds between polling = %d\n", poll_time); HDfprintf(verbose_file, "\t# of common symbols to poll = %d\n", ncommon); @@ -613,49 +607,50 @@ int main(int argc, const char *argv[]) HDfprintf(stdout, "READER: Using reader random seed: %u\n", random_seed); /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Generating symbol names\n"); /* Generate dataset names */ - if(generate_symbols() < 0) { + if (generate_symbols() < 0) { HDfprintf(stderr, "READER: Error generating symbol names!\n"); HDexit(1); } /* end if */ /* Create datatype for creating datasets */ - if((symbol_tid = create_symbol_datatype()) < 0) { + if ((symbol_tid = create_symbol_datatype()) < 0) { HDfprintf(stderr, "READER: Error creating symbol datatype!\n"); HDexit(1); } /* Reading records from datasets */ - if(read_records(VFD_SWMR_FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { + if (read_records(VFD_SWMR_FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, + (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { HDfprintf(stderr, "READER: Error reading records from datasets (random_seed = %u)!\n", random_seed); HDexit(1); } /* end if */ /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Releasing symbols\n"); /* Clean up the symbols */ - if(shutdown_symbols() < 0) { + if (shutdown_symbols() < 0) { HDfprintf(stderr, "READER: Error releasing symbols!\n"); HDexit(1); } /* end if */ /* Emit informational message */ - if(verbose) + if (verbose) HDfprintf(verbose_file, "READER: Closing objects\n"); /* Close objects created */ - if(H5Tclose(symbol_tid) < 0) { + if (H5Tclose(symbol_tid) < 0) { HDfprintf(stderr, "READER: Error closing symbol datatype!\n"); HDexit(1); } /* end if */ /* Close the output file */ - if(verbose) + if (verbose) HDfclose(verbose_file); return 0; |