Skip to content

Commit

Permalink
code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Jun 12, 2024
1 parent 4ce5aa0 commit 18e3b2c
Showing 1 changed file with 10 additions and 96 deletions.
106 changes: 10 additions & 96 deletions src/H5VL_log_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,102 +282,6 @@ err_out:;
*
*-------------------------------------------------------------------------
*/
static herr_t H5VL_log_dataset_read_1 (void *dset,
hid_t mem_type_id,
hid_t mem_space_id,
hid_t file_space_id,
hid_t plist_id,
void *buf,
void **req) {
herr_t err = 0;
H5VL_log_dset_t *dp = (H5VL_log_dset_t *)dset;
H5VL_log_dset_info_t *dip = NULL; // Dataset info
hid_t dsid; // Dataset space id
H5VL_log_selections *dsel = NULL; // Selection blocks

try {
if (!dp->fp->is_log_based_file) {
return H5VL_log_under_dataset_read (dp->uo, dp->uvlid, mem_type_id, mem_space_id, file_space_id,
plist_id, buf, NULL);
}
dip = dp->fp->dsets_info[dp->id];
H5VL_LOGI_PROFILING_TIMER_START;
if (file_space_id == H5S_ALL) {
dsid = H5Screate_simple (dip->ndim, dip->dims, dip->mdims);
CHECK_ID (dsid);
} else {
dsid = file_space_id;
}
dsel = new H5VL_log_selections (dsid);
H5VL_LOGI_PROFILING_TIMER_STOP (dp->fp, TIMER_H5VL_LOGI_GET_DATASPACE_SELECTION);

// H5S_All means using file space
if (mem_space_id == H5S_ALL) mem_space_id = dsid;

H5VL_log_dataseti_read (dp, mem_type_id, mem_space_id, dsel, plist_id, buf, req);
}
H5VL_LOGI_EXP_CATCH_ERR

err_out:;
// Note: dsel should be freed when the read request is deleted
if (dsid != file_space_id) { H5Sclose (dsid); }
return err;
} /* end H5VL_log_dataset_read() */

/*-------------------------------------------------------------------------
* Function: H5VL_log_dataset_write
*
* Purpose: Writes data elements from a buffer into a dataset.
*
* Return: Success: 0
* Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t H5VL_log_dataset_write_1 (void *dset,
hid_t mem_type_id,
hid_t mem_space_id,
hid_t file_space_id,
hid_t plist_id,
const void *buf,
void **req) {
herr_t err = 0;
H5VL_log_dset_t *dp = (H5VL_log_dset_t *)dset;

H5VL_log_dset_info_t *dip = NULL; // Dataset info
hid_t dsid; // Dataset space id
H5VL_log_selections *dsel = NULL; // Selection blocks

try {
if (!dp->fp->is_log_based_file) {
return H5VL_log_under_dataset_write (dp->uo, dp->uvlid, mem_type_id, mem_space_id, file_space_id,
plist_id, buf, NULL);
}
dip = dp->fp->dsets_info[dp->id];
H5VL_LOGI_PROFILING_TIMER_START;
if (file_space_id == H5S_ALL) {
dsid = H5Screate_simple (dip->ndim, dip->dims, dip->mdims);
CHECK_ID (dsid);
} else {
dsid = file_space_id;
}
dsel = new H5VL_log_selections (dsid);
H5VL_LOGI_PROFILING_TIMER_STOP (dp->fp, TIMER_H5VL_LOGI_GET_DATASPACE_SELECTION);
CHECK_PTR (dsel)

// H5S_All means using file space
if (mem_space_id == H5S_ALL) mem_space_id = dsid;

H5VL_log_dataseti_write (dp, mem_type_id, mem_space_id, dsel, plist_id, buf, req);
}
H5VL_LOGI_EXP_CATCH_ERR

err_out:;
if (dsel) { delete dsel; }
if (dsid != file_space_id) { H5Sclose (dsid); }
return err;
} /* end H5VL_log_dataset_write() */

herr_t H5VL_log_dataset_read (size_t count,
void *dset[],
hid_t mem_type_id[],
Expand Down Expand Up @@ -432,6 +336,16 @@ herr_t H5VL_log_dataset_read (size_t count,
return err;
}

/*-------------------------------------------------------------------------
* Function: H5VL_log_dataset_write
*
* Purpose: Writes data elements from a buffer into a dataset.
*
* Return: Success: 0
* Failure: -1
*
*-------------------------------------------------------------------------
*/
herr_t H5VL_log_dataset_write (size_t count,
void *dset[],
hid_t mem_type_id[],
Expand Down

0 comments on commit 18e3b2c

Please sign in to comment.