From f88607ed2482c694a23518fb8602543344b9d838 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 27 Aug 2009 14:44:08 -0500 Subject: [PATCH] [svn-r17432] Description: Simplify out dataspace cleanup code. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.8 (amazon) in debug mode Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- src/H5Z.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/H5Z.c b/src/H5Z.c index 1c58ab06f4..dc1ad80dbd 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -497,7 +497,8 @@ done: static herr_t H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type) { - herr_t ret_value = SUCCEED; /* Return value */ + hid_t space_id = -1; /* ID for dataspace describing chunk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback) @@ -529,7 +530,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if(dcpl_pline.nused > 0) { hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ H5S_t *space; /* Dataspace describing chunk */ - hid_t space_id; /* ID for dataspace describing chunk */ size_t u; /* Local index variable */ /* Create a data space for a chunk & set the extent */ @@ -572,10 +572,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check return value */ if(status <= 0) { - /* We're leaving, so close dataspace */ - if(H5I_dec_ref(space_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") - /* Indicate filter can't apply to this combination of parameters */ if(status == 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") @@ -590,14 +586,9 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check if there is a "set local" callback */ if(fclass->set_local) { /* Make callback to filter's "set local" function */ - if((fclass->set_local)(dcpl_id, type_id, space_id)<0) { - /* We're leaving, so close dataspace */ - if(H5I_dec_ref(space_id, FALSE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") - + if((fclass->set_local)(dcpl_id, type_id, space_id) < 0) /* Indicate error during filter callback */ HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") - } /* end if */ } /* end if */ break; @@ -606,15 +597,14 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty } /* end switch */ } /* end else */ } /* end for */ - - /* Close dataspace */ - if(H5I_dec_ref(space_id, FALSE) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") } /* end if */ } /* end if */ } /* end if */ done: + if(space_id > 0 && H5I_dec_ref(space_id, FALSE) < 0) + HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_prelude_callback() */