summaryrefslogtreecommitdiffstats
path: root/src/H5Gstab.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-28 13:11:38 (GMT)
commit3360c3af0c100ac4d3a2fe2865f34661da862ec5 (patch)
tree9caf7dba62679504aa39ec02ebb72d8b8b5a848d /src/H5Gstab.c
parent5b4d3279099e7e4fad6e0092c77aa93dfd35d616 (diff)
downloadhdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.zip
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.gz
hdf5-3360c3af0c100ac4d3a2fe2865f34661da862ec5.tar.bz2
[svn-r18175] Description:
Bring r17986:18172 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5Gstab.c')
-rw-r--r--src/H5Gstab.c107
1 files changed, 52 insertions, 55 deletions
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 52c9d07..cba725f 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -33,9 +33,8 @@
/* User data for finding link information from B-tree */
typedef struct {
/* downward */
- H5F_t *file; /* Pointer to file for query */
const char *name; /* Name to search for */
- H5HL_t *heap; /* Local heap for group */
+ H5HL_t *heap; /* Local heap for group */
/* upward */
H5O_link_t *lnk; /* Caller's link location */
@@ -45,7 +44,7 @@ typedef struct {
typedef struct H5G_bt_it_gnbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
- H5HL_t *heap; /*symbol table heap */
+ H5HL_t *heap; /*symbol table heap */
/* upward */
char *name; /*member name to be returned */
@@ -56,6 +55,7 @@ typedef struct H5G_bt_it_gnbi_t {
typedef struct H5G_bt_it_gtbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
+ H5F_t *f; /* Pointer to file that symbol table is in */
hid_t dxpl_id; /* DXPL for operation */
/* upward */
@@ -67,7 +67,7 @@ typedef struct H5G_bt_it_gtbi_t {
typedef struct H5G_bt_it_lbi_t {
/* downward */
H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */
- H5HL_t *heap; /*symbol table heap */
+ H5HL_t *heap; /*symbol table heap */
/* upward */
H5O_link_t *lnk; /*link to be returned */
@@ -99,9 +99,9 @@ typedef struct H5G_bt_it_lbi_t {
herr_t
H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- size_t name_offset; /* Offset of "" name */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ size_t name_offset; /* Offset of "" name */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_create_components, FAIL)
@@ -136,7 +136,7 @@ H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t d
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -223,9 +223,9 @@ herr_t
H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
H5O_link_t *obj_lnk, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_ins_t udata; /* Data to pass through B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_ins_t udata; /* Data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_insert_real, FAIL)
@@ -250,7 +250,7 @@ H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -315,9 +315,9 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
const char *name)
{
H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /*symbol table message */
- H5G_bt_rm_t udata; /*data to pass through B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_stab_t stab; /*symbol table message */
+ H5G_bt_rm_t udata; /*data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL)
@@ -343,7 +343,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
done:
/* Release resources */
- if(heap && H5HL_unprotect(loc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -367,11 +367,11 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
H5_iter_order_t order, hsize_t n)
{
H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Symbol table message */
- H5G_bt_rm_t udata; /* Data to pass through B-tree */
- H5O_link_t obj_lnk; /* Object's link within group */
- hbool_t lnk_copied = FALSE; /* Whether the link was copied */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_stab_t stab; /* Symbol table message */
+ H5G_bt_rm_t udata; /* Data to pass through B-tree */
+ H5O_link_t obj_lnk; /* Object's link within group */
+ hbool_t lnk_copied = FALSE; /* Whether the link was copied */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL)
@@ -401,7 +401,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
/* Reset the link information, if we have a copy */
@@ -429,9 +429,9 @@ done:
herr_t
H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_rm_t udata; /*data to pass through B-tree */
- herr_t ret_value = SUCCEED;
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_rm_t udata; /*data to pass through B-tree */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL)
@@ -453,7 +453,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree")
/* Release resources */
- if(H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(H5HL_unprotect(heap) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
heap = NULL;
@@ -463,7 +463,7 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab)
done:
/* Release resources */
- if(heap && H5HL_unprotect(f, dxpl_id, heap, stab->heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -486,10 +486,10 @@ herr_t
H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data)
{
- H5HL_t *heap = NULL; /* Local heap for group */
- H5O_stab_t stab; /* Info about symbol table */
+ H5HL_t *heap = NULL; /* Local heap for group */
+ H5O_stab_t stab; /* Info about symbol table */
H5G_link_table_t ltable = {0, NULL}; /* Link table */
- herr_t ret_value;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL)
@@ -553,7 +553,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
done:
/* Release resources */
- if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
if(ltable.lnks && H5G_link_release_table(&ltable) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table")
@@ -677,7 +677,7 @@ H5G_stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata)
/* Get name offset in heap */
name_off = ent->name_off;
- name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, name_off);
HDassert(name);
udata->name = H5MM_strdup(name);
HDassert(udata->name);
@@ -703,10 +703,10 @@ ssize_t
H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
char* name, size_t size, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gnbi_t udata; /* Iteration information */
- ssize_t ret_value; /* Return value */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ H5G_bt_it_gnbi_t udata; /* Iteration information */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL)
@@ -734,7 +734,6 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
} /* end if */
/* Set iteration information */
- udata.common.f = oloc->file;
udata.common.idx = n;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_get_name_by_idx_cb;
@@ -761,7 +760,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
done:
/* Release resources */
- if(heap && H5HL_unprotect(oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
/* Free the duplicated name */
@@ -797,7 +796,7 @@ H5G_stab_lookup_cb(const H5G_entry_t *ent, void *_udata)
/* Check for setting link info */
if(udata->lnk)
/* Convert the entry to a link */
- if(H5G_ent_to_link(udata->file, udata->lnk, udata->heap, ent, udata->name) < 0)
+ if(H5G_ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
done:
@@ -822,10 +821,10 @@ htri_t
H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */
- H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */
- H5O_stab_t stab; /* Symbol table message */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */
+ H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */
+ H5O_stab_t stab; /* Symbol table message */
htri_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_lookup, FAIL)
@@ -844,7 +843,6 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")
/* Set up user data to pass to 'find' operation callback */
- udata.file = grp_oloc->file;
udata.name = name;
udata.lnk = lnk;
udata.heap = heap;
@@ -861,7 +859,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -896,11 +894,11 @@ H5G_stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata)
HDassert(udata && udata->heap);
/* Get a pointer to the link name */
- name = (const char *)H5HL_offset_into(udata->common.f, udata->heap, ent->name_off);
+ name = (const char *)H5HL_offset_into(udata->heap, ent->name_off);
HDassert(name);
/* Convert the entry to a link */
- if(H5G_ent_to_link(udata->common.f, udata->lnk, udata->heap, ent, name) < 0)
+ if(H5G_ent_to_link(udata->lnk, udata->heap, ent, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link")
udata->found = TRUE;
@@ -926,10 +924,10 @@ herr_t
H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
H5O_link_t *lnk, hid_t dxpl_id)
{
- H5HL_t *heap = NULL; /* Pointer to local heap */
- H5G_bt_it_lbi_t udata; /* Iteration information */
+ H5HL_t *heap = NULL; /* Pointer to local heap */
+ H5G_bt_it_lbi_t udata; /* Iteration information */
H5O_stab_t stab; /* Symbol table message */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_lookup_by_idx, FAIL)
@@ -958,7 +956,6 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
} /* end if */
/* Set iteration information */
- udata.common.f = grp_oloc->file;
udata.common.idx = n;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_lookup_by_idx_cb;
@@ -976,7 +973,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1051,7 +1048,7 @@ H5G_stab_valid(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5O_stab_t *alt_stab)
done:
/* Release resources */
- if(heap && H5HL_unprotect(grp_oloc->file, dxpl_id, heap, stab.heap_addr) < 0)
+ if(heap && H5HL_unprotect(heap) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap")
FUNC_LEAVE_NOAPI(ret_value)
@@ -1098,7 +1095,7 @@ H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata)
H5O_type_t obj_type; /* Type of object at location */
/* Build temporary object location */
- tmp_oloc.file = udata->common.f;
+ tmp_oloc.file = udata->f;
HDassert(H5F_addr_defined(ent->header));
tmp_oloc.addr = ent->header;
@@ -1147,10 +1144,10 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address")
/* Set iteration information */
- udata.common.f = oloc->file;
udata.common.idx = idx;
udata.common.num_objs = 0;
udata.common.op = H5G_stab_get_type_by_idx_cb;
+ udata.f = oloc->file;
udata.dxpl_id = dxpl_id;
udata.type = H5G_UNKNOWN;