diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-08-29 13:54:05 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-08-29 13:54:05 (GMT) |
commit | b254caea6c838b448460db5d4b3985fecf6ead97 (patch) | |
tree | ccd20872875560ce3c4d04d9ba906f63c9e7d536 /src/H5VLiod_client.c | |
parent | 6d1b20cf3c2689e4d8d3d3bcd42be9cf3591789d (diff) | |
download | hdf5-b254caea6c838b448460db5d4b3985fecf6ead97.zip hdf5-b254caea6c838b448460db5d4b3985fecf6ead97.tar.gz hdf5-b254caea6c838b448460db5d4b3985fecf6ead97.tar.bz2 |
[svn-r24085] Add a common routine to decrement ref count on a request and free if ref count reaches 0.
Diffstat (limited to 'src/H5VLiod_client.c')
-rw-r--r-- | src/H5VLiod_client.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index d81034e..74db59b 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -60,6 +60,21 @@ static herr_t H5VL__iod_pre_write_cb(void UNUSED *elem, hid_t type_id, unsigned static herr_t H5VL__iod_vl_read_finalize(size_t buf_size, void *read_buf, void *user_buf, H5S_t *mem_space, hid_t mem_type_id, hid_t dset_type_id); +herr_t +H5VL_iod_request_decr_rc(H5VL_iod_request_t *request) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + request->rc --; + + if(0 == request->rc) { + request->parent_reqs = (H5VL_iod_request_t **)H5MM_xfree(request->parent_reqs); + request = (H5VL_iod_request_t *)H5MM_xfree(request); + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} + /*------------------------------------------------------------------------- * Function: H5VL_iod_request_add @@ -119,13 +134,8 @@ H5VL_iod_request_delete(H5VL_iod_file_t *file, H5VL_iod_request_t *request) /* decrement ref count on parent requests */ for(u=0 ; u<request->num_parents ; u++) { - request->parent_reqs[u]->rc --; - if(0 == request->parent_reqs[u]->rc) { - request->parent_reqs[u]->parent_reqs = (H5VL_iod_request_t **) - H5MM_xfree(request->parent_reqs[u]->parent_reqs); - request->parent_reqs[u] = (H5VL_iod_request_t *) - H5MM_xfree(request->parent_reqs[u]); - } + /* Decrement ref count on request */ + H5VL_iod_request_decr_rc(request->parent_reqs[u]); } prev = request->prev; |