summaryrefslogtreecommitdiffstats
path: root/src/H5Gcompact.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
commit1ba1f2f3222cbe8df0bf601929a4bffd478d7e02 (patch)
treeae51dfc33cf40432dad25a5088767115a98f195e /src/H5Gcompact.c
parent8eef7d295cc3dd134aef0a826f1de4287629996d (diff)
downloadhdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.zip
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.gz
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.bz2
Source formatted
Diffstat (limited to 'src/H5Gcompact.c')
-rw-r--r--src/H5Gcompact.c251
1 files changed, 117 insertions, 134 deletions
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index 6577d0c..8dc0663 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -21,51 +21,48 @@
*
*-------------------------------------------------------------------------
*/
-#define H5G_PACKAGE /*suppress error about including H5Gpkg */
-
+#define H5G_PACKAGE /*suppress error about including H5Gpkg */
/* Packages needed by this file... */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Gpkg.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Gpkg.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
/* Private typedefs */
/* User data for link message iteration when building link table */
typedef struct {
H5G_link_table_t *ltable; /* Pointer to link table to build */
- size_t curr_lnk; /* Current link to operate on */
+ size_t curr_lnk; /* Current link to operate on */
} H5G_iter_bt_t;
/* User data for deleting a link in the link messages */
typedef struct {
/* downward */
- H5F_t *file; /* File that object header is located within */
- hid_t dxpl_id; /* DXPL during insertion */
- H5RS_str_t *grp_full_path_r;/* Full path for group of link */
- const char *name; /* Link name to search for */
+ H5F_t * file; /* File that object header is located within */
+ hid_t dxpl_id; /* DXPL during insertion */
+ H5RS_str_t *grp_full_path_r; /* Full path for group of link */
+ const char *name; /* Link name to search for */
} H5G_iter_rm_t;
/* User data for link message iteration when querying link info */
typedef struct {
/* downward */
- const char *name; /* Name to search for */
+ const char *name; /* Name to search for */
/* upward */
- H5O_link_t *lnk; /* Link struct to fill in */
- hbool_t found; /* Flag to indicate that the object was found */
+ H5O_link_t *lnk; /* Link struct to fill in */
+ hbool_t found; /* Flag to indicate that the object was found */
} H5G_iter_lkp_t;
/* Private macros */
/* PRIVATE PROTOTYPES */
static herr_t H5G_compact_build_table_cb(const void *_mesg, unsigned idx, void *_udata);
-static herr_t H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id,
- const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
- H5G_link_table_t *ltable);
+static herr_t H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable);
-
/*-------------------------------------------------------------------------
* Function: H5G_compact_build_table_cb
*
@@ -83,9 +80,9 @@ static herr_t H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id,
static herr_t
H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
- const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
- H5G_iter_bt_t *udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */
- herr_t ret_value=H5_ITER_CONT; /* Return value */
+ const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
+ H5G_iter_bt_t * udata = (H5G_iter_bt_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -95,7 +92,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void
HDassert(udata->curr_lnk < udata->ltable->nlinks);
/* Copy link message into table */
- if(NULL == H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])))
+ if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
/* Increment current link entry to operate on */
@@ -105,7 +102,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_build_table_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5G_compact_build_table
*
@@ -121,10 +117,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
- H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable)
+H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, H5G_link_table_t *ltable)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -138,26 +134,26 @@ H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t
ltable->nlinks = (size_t)linfo->nlinks;
/* Allocate space for the table entries */
- if(ltable->nlinks > 0) {
- H5G_iter_bt_t udata; /* User data for iteration callback */
- H5O_mesg_operator_t op; /* Message operator */
+ if (ltable->nlinks > 0) {
+ H5G_iter_bt_t udata; /* User data for iteration callback */
+ H5O_mesg_operator_t op; /* Message operator */
/* Allocate the link table */
- if((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL)
+ if ((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set up user data for iteration */
- udata.ltable = ltable;
+ udata.ltable = ltable;
udata.curr_lnk = 0;
/* Iterate through the link messages, adding them to the table */
- op.op_type = H5O_MESG_OP_APP;
+ op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_build_table_cb;
- if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
+ if (H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Sort link table in correct iteration order */
- if(H5G__link_sort_table(ltable, idx_type, order) < 0)
+ if (H5G__link_sort_table(ltable, idx_type, order) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages")
} /* end if */
else
@@ -167,7 +163,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_build_table() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_insert
*
@@ -184,10 +179,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
- hid_t dxpl_id)
+H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk, hid_t dxpl_id)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -196,14 +190,13 @@ H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk,
HDassert(obj_lnk);
/* Insert link message into group */
- if(H5O_msg_create(grp_oloc, H5O_LINK_ID, 0, H5O_UPDATE_TIME, obj_lnk, dxpl_id) < 0)
+ if (H5O_msg_create(grp_oloc, H5O_LINK_ID, 0, H5O_UPDATE_TIME, obj_lnk, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_insert() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_get_name_by_idx
*
@@ -218,12 +211,11 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
- const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t idx, char* name, size_t size)
+H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, char *name, size_t size)
{
- H5G_link_table_t ltable = {0, NULL}; /* Link table */
- ssize_t ret_value; /* Return value */
+ H5G_link_table_t ltable = {0, NULL}; /* Link table */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_PACKAGE
@@ -231,32 +223,31 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if (H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
+ if (idx >= ltable.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Get the length of the name */
ret_value = (ssize_t)HDstrlen(ltable.lnks[idx].name);
/* Copy the name into the user's buffer, if given */
- if(name) {
+ if (name) {
HDstrncpy(name, ltable.lnks[idx].name, MIN((size_t)(ret_value + 1), size));
- if((size_t)ret_value >= size)
- name[size - 1]='\0';
+ if ((size_t)ret_value >= size)
+ name[size - 1] = '\0';
} /* end if */
done:
/* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
+ if (ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_get_name_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5G_compact_remove_common_cb
*
@@ -274,9 +265,9 @@ done:
static herr_t
H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
- const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
- H5G_iter_rm_t *udata = (H5G_iter_rm_t *)_udata; /* 'User data' passed in */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
+ H5G_iter_rm_t * udata = (H5G_iter_rm_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -285,9 +276,9 @@ H5G_compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi
HDassert(udata);
/* If we've found the right link, get the object type */
- if(HDstrcmp(lnk->name, udata->name) == 0) {
+ if (HDstrcmp(lnk->name, udata->name) == 0) {
/* Replace path names for link being removed */
- if(H5G__link_name_replace(udata->file, udata->dxpl_id, udata->grp_full_path_r, lnk) < 0)
+ if (H5G__link_name_replace(udata->file, udata->dxpl_id, udata->grp_full_path_r, lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type")
/* Stop the iteration, we found the correct link */
@@ -298,7 +289,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_remove_common_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_remove
*
@@ -312,11 +302,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
- const char *name)
+H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name)
{
H5G_iter_rm_t udata; /* Data to pass through OH iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -324,20 +313,20 @@ H5G__compact_remove(const H5O_loc_t *oloc, hid_t dxpl_id, H5RS_str_t *grp_full_p
HDassert(name && *name);
/* Initialize data to pass through object header iteration */
- udata.file = oloc->file;
- udata.dxpl_id = dxpl_id;
+ udata.file = oloc->file;
+ udata.dxpl_id = dxpl_id;
udata.grp_full_path_r = grp_full_path_r;
- udata.name = name;
+ udata.name = name;
/* Iterate over the link messages to delete the right one */
- if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) < 0)
+ if (H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_remove_by_idx
*
@@ -351,13 +340,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
- const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n)
+H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
+ H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order, hsize_t n)
{
- H5G_link_table_t ltable = {0, NULL};/* Link table */
- H5G_iter_rm_t udata; /* Data to pass through OH iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_link_table_t ltable = {0, NULL}; /* Link table */
+ H5G_iter_rm_t udata; /* Data to pass through OH iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -365,32 +353,32 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id,
HDassert(linfo);
/* Build table of all link messages, sorted according to desired order */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if (H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
- if(n >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound")
+ if (n >= ltable.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound")
/* Initialize data to pass through object header iteration */
- udata.file = oloc->file;
- udata.dxpl_id = dxpl_id;
+ udata.file = oloc->file;
+ udata.dxpl_id = dxpl_id;
udata.grp_full_path_r = grp_full_path_r;
- udata.name = ltable.lnks[n].name;
+ udata.name = ltable.lnks[n].name;
/* Iterate over the link messages to delete the right one */
- if(H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) < 0)
+ if (H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G_compact_remove_common_cb, &udata, TRUE, dxpl_id) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message")
done:
/* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
+ if (ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_remove_by_idx() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_iterate
*
@@ -404,12 +392,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
- H5G_lib_iterate_t op, void *op_data)
+H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
+ void *op_data)
{
- H5G_link_table_t ltable = {0, NULL}; /* Link table */
- herr_t ret_value; /* Return value */
+ H5G_link_table_t ltable = {0, NULL}; /* Link table */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_PACKAGE
@@ -419,22 +407,21 @@ H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *li
HDassert(op);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if (H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Iterate over links in table */
- if((ret_value = H5G__link_iterate_table(&ltable, skip, last_lnk, op, op_data)) < 0)
+ if ((ret_value = H5G__link_iterate_table(&ltable, skip, last_lnk, op, op_data)) < 0)
HERROR(H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
/* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
+ if (ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5G_compact_lookup_cb
*
@@ -452,9 +439,9 @@ done:
static herr_t
H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_udata)
{
- const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
- H5G_iter_lkp_t *udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ const H5O_link_t *lnk = (const H5O_link_t *)_mesg; /* Pointer to link */
+ H5G_iter_lkp_t * udata = (H5G_iter_lkp_t *)_udata; /* 'User data' passed in */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -463,10 +450,10 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_uda
HDassert(udata);
/* Check for name to get information */
- if(HDstrcmp(lnk->name, udata->name) == 0) {
- if(udata->lnk) {
+ if (HDstrcmp(lnk->name, udata->name) == 0) {
+ if (udata->lnk) {
/* Copy link information */
- if(NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk))
+ if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
} /* end if */
@@ -481,7 +468,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_compact_lookup_cb() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_lookup
*
@@ -496,12 +482,11 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
- hid_t dxpl_id)
+H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id)
{
- H5G_iter_lkp_t udata; /* User data for iteration callback */
- H5O_mesg_operator_t op; /* Message operator */
- htri_t ret_value; /* Return value */
+ H5G_iter_lkp_t udata; /* User data for iteration callback */
+ H5O_mesg_operator_t op; /* Message operator */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_PACKAGE
@@ -510,14 +495,14 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk,
HDassert(name && *name);
/* Set up user data for iteration */
- udata.name = name;
- udata.lnk = lnk;
+ udata.name = name;
+ udata.lnk = lnk;
udata.found = FALSE;
/* Iterate through the link messages, adding them to the table */
- op.op_type = H5O_MESG_OP_APP;
+ op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_lookup_cb;
- if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
+ if (H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Determine if we found the link we were looking for */
@@ -527,7 +512,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_lookup() */
-
/*-------------------------------------------------------------------------
* Function: H5G__compact_lookup_by_idx
*
@@ -544,10 +528,10 @@ done:
*/
herr_t
H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk)
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk)
{
- H5G_link_table_t ltable = {0, NULL};/* Link table */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_link_table_t ltable = {0, NULL}; /* Link table */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -557,27 +541,27 @@ H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo
HDassert(lnk);
/* Build table of all link messages, sorted according to desired order */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
+ if (H5G_compact_build_table(oloc, dxpl_id, linfo, idx_type, order, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table")
/* Check for going out of bounds */
- if(n >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound")
+ if (n >= ltable.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound")
/* Copy link information */
- if(NULL == H5O_msg_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
+ if (NULL == H5O_msg_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
done:
/* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
+ if (ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_lookup_by_idx() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
-
+
/*-------------------------------------------------------------------------
* Function: H5G__compact_get_type_by_idx
*
@@ -592,11 +576,10 @@ done:
*-------------------------------------------------------------------------
*/
H5G_obj_t
-H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
- hsize_t idx)
+H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, hsize_t idx)
{
- H5G_link_table_t ltable = {0, NULL}; /* Link table */
- H5G_obj_t ret_value; /* Return value */
+ H5G_link_table_t ltable = {0, NULL}; /* Link table */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_PACKAGE
@@ -604,43 +587,43 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *
HDassert(oloc);
/* Build table of all link messages */
- if(H5G_compact_build_table(oloc, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
+ if (H5G_compact_build_table(oloc, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_INC, &ltable) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table")
/* Check for going out of bounds */
- if(idx >= ltable.nlinks)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
+ if (idx >= ltable.nlinks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound")
/* Determine type of object */
- if(ltable.lnks[idx].type == H5L_TYPE_SOFT)
+ if (ltable.lnks[idx].type == H5L_TYPE_SOFT)
ret_value = H5G_LINK;
- else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
+ else if (ltable.lnks[idx].type >= H5L_TYPE_UD_MIN)
ret_value = H5G_UDLINK;
- else if(ltable.lnks[idx].type == H5L_TYPE_HARD){
- H5O_loc_t tmp_oloc; /* Temporary object location */
- H5O_type_t obj_type; /* Type of object at location */
+ else if (ltable.lnks[idx].type == H5L_TYPE_HARD) {
+ H5O_loc_t tmp_oloc; /* Temporary object location */
+ H5O_type_t obj_type; /* Type of object at location */
/* Build temporary object location */
tmp_oloc.file = oloc->file;
tmp_oloc.addr = ltable.lnks[idx].u.hard.addr;
/* Get the type of the object */
- if(H5O_obj_type(&tmp_oloc, &obj_type, dxpl_id) < 0)
+ if (H5O_obj_type(&tmp_oloc, &obj_type, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type")
/* Map to group object type */
- if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
+ if (H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type")
- } else {
+ }
+ else {
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type")
} /* end else */
done:
/* Release link table */
- if(ltable.lnks && H5G__link_release_table(&ltable) < 0)
+ if (ltable.lnks && H5G__link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__compact_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-