summaryrefslogtreecommitdiffstats
path: root/src/H5I.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5I.c')
-rw-r--r--src/H5I.c175
1 files changed, 86 insertions, 89 deletions
diff --git a/src/H5I.c b/src/H5I.c
index aaa1e54..e30cdc0 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -1099,95 +1099,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Iget_file_id
- *
- * Purpose: The public version of H5I_get_file_id(), obtains the file
- * ID given an object ID. User has to close this ID.
- *
- * Return: Success: file ID
- *
- * Failure: a negative value
- *
- * Programmer: Raymond Lu
- * Oct 27, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5Iget_file_id(hid_t obj_id)
-{
- hid_t ret_value;
-
- FUNC_ENTER_API(H5Iget_file_id, FAIL);
- H5TRACE1("i","i",obj_id);
-
- if((ret_value = H5I_get_file_id(obj_id))<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID");
-
-done:
- FUNC_LEAVE_API(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5I_get_file_id
- *
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
- *
- * Return: Success: file ID
- *
- * Failure: a negative value
- *
- * Programmer: Raymond Lu
- * Oct 27, 2003
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static hid_t
-H5I_get_file_id(hid_t obj_id)
-{
- H5G_entry_t *ent;
- hid_t ret_value;
- H5I_type_t type;
-
- FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id);
-
- /* Get object type */
- type = H5I_TYPE(obj_id);
- if(type == H5I_FILE)
- {
- ret_value = obj_id;
-
- /* Increment reference count on atom. */
- if (H5I_inc_ref(ret_value)<0)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed");
- }
- else if(type == H5I_DATATYPE)
- {
- if((ent = H5G_loc(obj_id))==NULL)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype");
- ret_value = H5F_get_id(ent->file);
- }
- else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR)
- {
- if((ent = H5G_loc(obj_id))==NULL)
- HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info");
- ret_value = H5F_get_id(ent->file);
- }
- else
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5Iremove_verify
*
* Purpose: Removes the specified ID from its type, first checking that the
@@ -2219,3 +2130,89 @@ done:
}
#endif /* H5I_DEBUG_OUTPUT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Iget_file_id
+ *
+ * Purpose: The public version of H5I_get_file_id(), obtains the file
+ * ID given an object ID. User has to close this ID.
+ *
+ * Return: Success: file ID
+ *
+ * Failure: a negative value
+ *
+ * Programmer: Raymond Lu
+ * Oct 27, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Iget_file_id(hid_t obj_id)
+{
+ hid_t ret_value;
+
+ FUNC_ENTER_API(H5Iget_file_id, FAIL);
+ H5TRACE1("i","i",obj_id);
+
+ if((ret_value = H5I_get_file_id(obj_id))<0)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID");
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_file_id
+ *
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
+ * ID given an object ID.
+ *
+ * Return: Success: file ID
+ *
+ * Failure: a negative value
+ *
+ * Programmer: Raymond Lu
+ * Oct 27, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static hid_t
+H5I_get_file_id(hid_t obj_id)
+{
+ H5G_entry_t *ent;
+ H5I_type_t type;
+ hid_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id);
+
+ /* Get object type */
+ type = H5I_TYPE(obj_id);
+ if(type == H5I_FILE) {
+ ret_value = obj_id;
+
+ /* Increment reference count on atom. */
+ if (H5I_inc_ref(ret_value)<0)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed");
+ }
+ else if(type == H5I_DATATYPE) {
+ if((ent = H5G_loc(obj_id))==NULL)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype");
+ ret_value = H5F_get_id(ent->file);
+ }
+ else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) {
+ if((ent = H5G_loc(obj_id))==NULL)
+ HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info");
+ ret_value = H5F_get_id(ent->file);
+ }
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+