summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-07-31 19:17:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-07-31 19:17:12 (GMT)
commit5588db111c57b4a60de020e49e3411330bf8cf00 (patch)
tree326710b2fb5ab935c5a5c76b0a1fd5855d54549e /src/H5FD.c
parent17275779d07c094741039d0c263fdf055c32bfb6 (diff)
downloadhdf5-5588db111c57b4a60de020e49e3411330bf8cf00.zip
hdf5-5588db111c57b4a60de020e49e3411330bf8cf00.tar.gz
hdf5-5588db111c57b4a60de020e49e3411330bf8cf00.tar.bz2
[svn-r5840] Purpose:
Code cleanup Description: Created a new H5I function which combined the some of the functionality of H5I_get_type and H5I_object: H5I_object_verify. Using this new function in the library trims another ~200 lines of code off the library and makes the resulting binaries smaller and faster also. Platforms tested: FreeBSD 4.6 (sleipnir)
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index fb25da8..49e7789 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -267,17 +267,12 @@ H5FDunregister(hid_t driver_id)
H5TRACE1("e","i",driver_id);
/* Check arguments */
- if (H5I_VFL!=H5I_get_type(driver_id) ||
- NULL==H5I_object(driver_id)) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file driver");
- }
+ if (NULL==H5I_object_verify(driver_id,H5I_VFL))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver");
/* The H5FD_class_t struct will be freed by this function */
- if (H5I_dec_ref(driver_id)<0) {
- HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
- "unable to unregister file driver");
- }
+ if (H5I_dec_ref(driver_id)<0)
+ HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to unregister file driver");
FUNC_LEAVE(SUCCEED);
}
@@ -518,11 +513,10 @@ H5FD_fapl_copy(hid_t driver_id, const void *old_fapl)
FUNC_ENTER_NOAPI(H5FD_fapl_copy, NULL);
/* Check args */
- if (H5I_VFL!=H5I_get_type(driver_id) ||
- NULL==(driver=H5I_object(driver_id))) {
+ if (NULL==(driver=H5I_object_verify(driver_id,H5I_VFL)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver ID");
- }
- if (!old_fapl) HRETURN(NULL); /*but no error*/
+ if (!old_fapl)
+ HRETURN(NULL); /*but no error*/
/* Allow the driver to copy or do it ourselves */
if (driver->fapl_copy) {
@@ -563,10 +557,8 @@ H5FD_fapl_free(hid_t driver_id, void *fapl)
FUNC_ENTER_NOAPI(H5FD_fapl_free, FAIL);
/* Check args */
- if (H5I_VFL!=H5I_get_type(driver_id) ||
- NULL==(driver=H5I_object(driver_id))) {
+ if (NULL==(driver=H5I_object_verify(driver_id,H5I_VFL)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID");
- }
/* Allow driver to free or do it ourselves */
if (fapl && driver->fapl_free) {
@@ -611,12 +603,10 @@ H5FD_dxpl_copy(hid_t driver_id, const void *old_dxpl)
FUNC_ENTER_NOAPI(H5FD_dxpl_copy, NULL);
/* Check args */
- if (H5I_VFL!=H5I_get_type(driver_id) ||
- NULL==(driver=H5I_object(driver_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a driver ID");
- }
- if (!old_dxpl) HRETURN(NULL); /*but no error*/
+ if (NULL==(driver=H5I_object_verify(driver_id,H5I_VFL)))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver ID");
+ if (!old_dxpl)
+ HRETURN(NULL); /*but no error*/
/* Allow the driver to copy or do it ourselves */
if (driver->dxpl_copy) {
@@ -657,10 +647,8 @@ H5FD_dxpl_free(hid_t driver_id, void *dxpl)
FUNC_ENTER_NOAPI(H5FD_dxpl_free, FAIL);
/* Check args */
- if (H5I_VFL!=H5I_get_type(driver_id) ||
- NULL==(driver=H5I_object(driver_id))) {
+ if (NULL==(driver=H5I_object_verify(driver_id,H5I_VFL)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID");
- }
/* Allow driver to free or do it ourselves */
if (dxpl && driver->dxpl_free) {
@@ -793,7 +781,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
/* Get driver info */
- if (H5I_VFL!=H5I_get_type(driver_id) || NULL==(driver=H5I_object(driver_id)))
+ if (NULL==(driver=H5I_object_verify(driver_id,H5I_VFL)))
HRETURN_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list");
if (NULL==driver->open)
HRETURN_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method");