summaryrefslogtreecommitdiffstats
path: root/src/H5Itest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-28 12:33:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-28 12:33:13 (GMT)
commit73ee20aeb7724483d3e95fbcd81ab1589f481572 (patch)
tree04664ea9aac0bfa453053b06049c59714135d40e /src/H5Itest.c
parentf99e0b9f75df7b9964c650b0ac0a0378dbb1a209 (diff)
downloadhdf5-73ee20aeb7724483d3e95fbcd81ab1589f481572.zip
hdf5-73ee20aeb7724483d3e95fbcd81ab1589f481572.tar.gz
hdf5-73ee20aeb7724483d3e95fbcd81ab1589f481572.tar.bz2
[svn-r19134] Description:
Bring r19133 from trunk to 1.8 branch: Correct traversal of user-defined links (including external links) to retain path information of object, allowing H5Iget_name() queries to work quickly (without searching entire destination file). This required some refactoring and addition of a mechanism to detect if a "fast" query was performed (for the tests). Minor code cleanups, etc. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode (h5committest performed on trunk)
Diffstat (limited to 'src/H5Itest.c')
-rw-r--r--src/H5Itest.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/H5Itest.c b/src/H5Itest.c
new file mode 100644
index 0000000..1c6892d
--- /dev/null
+++ b/src/H5Itest.c
@@ -0,0 +1,98 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Quincey Koziol <koziol@hdfgoup.org>
+ * Tuesday, July 27, 2010
+ *
+ * Purpose: ID testing functions.
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+#define H5I_TESTING /*suppress warning about H5I testing funcs*/
+
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gprivate.h" /* Groups */
+#include "H5Ipkg.h" /* IDs */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5I_get_name_test
+ *
+ * Purpose: Testing version of H5Iget_name()
+ *
+ * Return: Success: The length of name.
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, July 27, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached)
+{
+ H5G_loc_t loc; /* Object location */
+ ssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5I_get_name_test, FAIL)
+
+ /* Get object location */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location")
+
+ /* Call internal group routine to retrieve object's name */
+ if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5I_get_name_test() */
+