summaryrefslogtreecommitdiffstats
path: root/src/H5VL.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-12-12 21:17:25 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-12-12 21:52:21 (GMT)
commitce653ff82b7dd52b8e36a5eff7b1728c4b75d9f7 (patch)
tree090eb5eb5cff5f166df5d4b18da0bfc0de6e4816 /src/H5VL.c
parent8026c67a1c34e9d3dcaffe12f22d00e4ced64878 (diff)
downloadhdf5-ce653ff82b7dd52b8e36a5eff7b1728c4b75d9f7.zip
hdf5-ce653ff82b7dd52b8e36a5eff7b1728c4b75d9f7.tar.gz
hdf5-ce653ff82b7dd52b8e36a5eff7b1728c4b75d9f7.tar.bz2
Modify H5VL initialization routines to initialize all VOL-managed object
types. Modify H5VLwrap_register() to reject non-VOL-managed object types. Also fix overisights in h5trace.c from previous changes.
Diffstat (limited to 'src/H5VL.c')
-rw-r--r--src/H5VL.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/H5VL.c b/src/H5VL.c
index 6790465..df05396 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -477,6 +477,9 @@ done:
* iteration routine callbacks (i.e. the callbacks from H5Aiterate*,
* H5Literate* / H5Lvisit*, and H5Ovisit* ).
*
+ * type must be a VOL-managed object class (H5I_FILE,
+ * H5I_GROUP, H5I_DATATYPE, H5I_DATASET, H5I_MAP, or H5I_ATTR).
+ *
* Return: Success: Non-negative hid_t for the object.
* Failure: Negative (H5I_INVALID_HID)
*
@@ -492,8 +495,34 @@ H5VLwrap_register(void *obj, H5I_type_t type)
H5TRACE2("i", "*xIt", obj, type);
/* Check args */
- if(type <= H5I_BADID || type >= H5I_NTYPES)
- HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ /* Use a switch here for (hopefully) better performance than a series of
+ * equality checks. We could also group these types together in H5I_type_t,
+ * make some assertions here to guarantee that, then just check the range.
+ */
+ switch(type) {
+ case H5I_FILE:
+ case H5I_GROUP:
+ case H5I_DATATYPE:
+ case H5I_DATASET:
+ case H5I_MAP:
+ case H5I_ATTR:
+ /* VOL-managed objects, call is valid */
+ break;
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_DATASPACE:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number")
+ } /* end switch */
if(NULL == obj)
HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL")