summaryrefslogtreecommitdiffstats
path: root/src/H5Gint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Gint.c')
-rw-r--r--src/H5Gint.c95
1 files changed, 43 insertions, 52 deletions
diff --git a/src/H5Gint.c b/src/H5Gint.c
index b863e67..ce79f36 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -15,7 +15,7 @@
*
* Created: H5Gint.c
* April 5 2007
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: General use, "internal" routines for groups.
*
@@ -34,13 +34,13 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FOprivate.h" /* File objects */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FOprivate.h" /* File objects */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -152,9 +152,9 @@ H5G_t *
H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
hid_t dxpl_id)
{
- H5O_obj_create_t ocrt_info; /* Information for object creation */
- H5G_obj_create_t gcrt_info; /* Information for group creation */
- H5G_t * ret_value; /* Return value */
+ H5O_obj_create_t ocrt_info; /* Information for object creation */
+ H5G_obj_create_t gcrt_info; /* Information for group creation */
+ H5G_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -201,7 +201,6 @@ done:
* Failure: NULL
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Aug 11 1997
*
*-------------------------------------------------------------------------
@@ -211,7 +210,7 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id)
{
H5G_t * grp = NULL; /*new group */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
- H5G_t * ret_value; /* Return value */
+ H5G_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -287,7 +286,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, hid_t dxpl
H5O_loc_t grp_oloc; /* Opened object object location */
hbool_t loc_found = FALSE; /* Location at 'name' found */
H5O_type_t obj_type; /* Type of object at location */
- H5G_t * ret_value; /* Return value */
+ H5G_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -319,10 +318,9 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, hid_t dxpl
ret_value = grp;
done:
- if (!ret_value) {
+ if (!ret_value)
if (loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__open_name() */
@@ -345,9 +343,9 @@ done:
H5G_t *
H5G_open(const H5G_loc_t *loc, hid_t dxpl_id)
{
- H5G_t * grp = NULL; /* Group opened */
- H5G_shared_t *shared_fo; /* Shared group object */
- H5G_t * ret_value; /* Return value */
+ H5G_t * grp = NULL; /* Group opened */
+ H5G_shared_t *shared_fo; /* Shared group object */
+ H5G_t * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -765,12 +763,11 @@ done:
} /* end H5G_iterate_cb() */
/*-------------------------------------------------------------------------
- * Function: H5G_iterate
+ * Function: H5G_iterate
*
* Purpose: Private function for iterating over links in a group
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Oct 3, 2005
@@ -781,11 +778,11 @@ herr_t
H5G_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip,
hsize_t *last_lnk, const H5G_link_iterate_t *lnk_op, void *op_data, hid_t lapl_id, hid_t dxpl_id)
{
- H5G_loc_t loc; /* Location of parent for group */
- hid_t gid = -1; /* ID of group to iterate over */
- H5G_t * grp = NULL; /* Pointer to group data structure to iterate over */
- H5G_iter_appcall_ud_t udata; /* User data for callback */
- herr_t ret_value; /* Return value */
+ H5G_loc_t loc; /* Location of parent for group */
+ hid_t gid = H5I_INVALID_HID; /* ID of group to iterate over */
+ H5G_t * grp = NULL; /* Pointer to group data structure to iterate over */
+ H5G_iter_appcall_ud_t udata; /* User data for callback */
+ herr_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -794,8 +791,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_o
HDassert(last_lnk);
HDassert(lnk_op && lnk_op->op_func.op_new);
- /*
- * Open the group on which to operate. We also create a group ID which
+ /* Open the group on which to operate. We also create a group ID which
* we can pass to the application-defined operator.
*/
if (H5G_loc(loc_id, &loc) < 0)
@@ -820,7 +816,7 @@ done:
if (gid > 0) {
if (H5I_dec_app_ref(gid) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group")
- } /* end if */
+ }
else if (grp && H5G_close(grp) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group")
@@ -1013,9 +1009,9 @@ done:
} /* end H5G_visit_cb() */
/*-------------------------------------------------------------------------
- * Function: H5G_visit
+ * Function: H5G_visit
*
- * Purpose: Recursively visit all the links in a group and all
+ * Purpose: Recursively visit all the links in a group and all
* the groups that are linked to from that group. Links within
* each group are visited according to the order within the
* specified index (unless the specified index does not exist for
@@ -1027,18 +1023,13 @@ done:
* callback with more than one link that points to a particular
* _object_.
*
- * Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
- *
- *
- *
- * Programmer: Quincey Koziol
- * November 4 2007
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
*-------------------------------------------------------------------------
*/
@@ -1046,15 +1037,15 @@ herr_t
H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op,
void *op_data, hid_t lapl_id, hid_t dxpl_id)
{
- H5G_iter_visit_ud_t udata; /* User data for callback */
- H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info message exists */
- hid_t gid = (-1); /* Group ID */
- H5G_t * grp = NULL; /* Group opened */
- H5G_loc_t loc; /* Location of group passed in */
- H5G_loc_t start_loc; /* Location of starting group */
- unsigned rc; /* Reference count of object */
- herr_t ret_value; /* Return value */
+ H5G_iter_visit_ud_t udata; /* User data for callback */
+ H5O_linfo_t linfo; /* Link info message */
+ htri_t linfo_exists; /* Whether the link info message exists */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ H5G_t * grp = NULL; /* Group opened */
+ H5G_loc_t loc; /* Location of group passed in */
+ H5G_loc_t start_loc; /* Location of starting group */
+ unsigned rc; /* Reference count of object */
+ herr_t ret_value = FAIL; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));