diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-17 22:21:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-17 22:21:08 (GMT) |
commit | 1bc07c6aaeadd03d73216af25db0cb46db2391e0 (patch) | |
tree | 79cfb25eaad5e610b1c10f9a21b27ec9c07685b0 /src/H5Gnode.c | |
parent | df2fef9759940bf5d80e8aa5a8dcd1251d58d490 (diff) | |
parent | 77038a81755bd6c853323ba261c9c671800d7be7 (diff) | |
download | hdf5-1bc07c6aaeadd03d73216af25db0cb46db2391e0.zip hdf5-1bc07c6aaeadd03d73216af25db0cb46db2391e0.tar.gz hdf5-1bc07c6aaeadd03d73216af25db0cb46db2391e0.tar.bz2 |
[svn-r18031] Description:
Bring r18030 from merge_metadata_journaling branch to trunk:
Bring "brush clearing" changes (whitespace & style issues, mostly) from
metadata_journaling branch to the "merging" branch, to converge the trunk and
the metadata_journaling branch.
Also, some other minor cleanups along the way.
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 (smirom) 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
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r-- | src/H5Gnode.c | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a58c66a..ce41727 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -51,6 +51,7 @@ typedef struct H5G_node_key_t { size_t offset; /*offset into heap for name */ } H5G_node_key_t; + /* Private macros */ #define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4) @@ -131,16 +132,16 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) { H5RC_t *rc; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared) - assert(f); + HDassert(f); /* Increment reference count on shared B-tree node */ - rc=H5F_GRP_BTREE_SHARED(f); + rc = H5F_GRP_BTREE_SHARED(f); H5RC_INC(rc); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(rc); + FUNC_LEAVE_NOAPI(rc) } /* end H5G_node_get_shared() */ @@ -155,8 +156,6 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -164,16 +163,16 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_DECODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_decode_key() */ /*------------------------------------------------------------------------- @@ -187,8 +186,6 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -196,16 +193,16 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void * { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_ENCODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_encode_key() */ /*------------------------------------------------------------------------- @@ -262,8 +259,6 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t @@ -273,7 +268,7 @@ H5G_node_size_real(const H5F_t *f) FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) + (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)); -} +} /* end H5G_node_size_real() */ /*------------------------------------------------------------------------- @@ -305,7 +300,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, hsize_t size = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_node_create); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_create) /* * Check arguments. @@ -316,12 +311,12 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") size = H5G_node_size_real(f); + HDassert(size); if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") + if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed") - sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); - if(NULL == sym->entry) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") /* @@ -1022,7 +1017,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad done: /* Release resources */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1066,7 +1061,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr *num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1095,7 +1090,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add H5G_node_t *sn = NULL; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR); + FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR) /* * Check arguments. @@ -1127,10 +1122,10 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add udata->num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_by_idx() */ @@ -1155,7 +1150,7 @@ H5G_node_init(H5F_t *f) size_t sizeof_rkey; /* Size of raw (disk) key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_node_init, FAIL); + FUNC_ENTER_NOAPI(H5G_node_init, FAIL) /* Check arguments. */ HDassert(f); @@ -1175,7 +1170,7 @@ H5G_node_init(H5F_t *f) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_init() */ @@ -1200,13 +1195,13 @@ H5G_node_close(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_close) /* Check arguments. */ - assert(f); + HDassert(f); /* Free the raw B-tree node buffer */ - if (H5F_GRP_BTREE_SHARED(f)) + if(H5F_GRP_BTREE_SHARED(f)) H5RC_DEC(H5F_GRP_BTREE_SHARED(f)); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_node_close */ @@ -1227,13 +1222,13 @@ int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { - H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; - const H5O_loc_t *src_oloc = udata->src_oloc; - H5O_copy_t *cpy_info = udata->cpy_info; - H5HL_t *heap = NULL; - H5G_node_t *sn = NULL; - unsigned int i; /* Local index variable */ - int ret_value = H5_ITER_CONT; + H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; + const H5O_loc_t *src_oloc = udata->src_oloc; + H5O_copy_t *cpy_info = udata->cpy_info; + H5HL_t *heap = NULL; + H5G_node_t *sn = NULL; + unsigned int i; /* Local index variable */ + int ret_value = H5_ITER_CONT; FUNC_ENTER_NOAPI(H5G_node_copy, H5_ITER_ERROR) @@ -1333,10 +1328,10 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } /* end of for (i=0; i<sn->nsyms; i++) */ done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) + if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1411,7 +1406,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ done: /* Release the locked items */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1467,10 +1462,10 @@ herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap_addr) { - H5G_node_t *sn = NULL; - H5HL_t *heap = NULL; - unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sn = NULL; + H5HL_t *heap = NULL; + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_node_debug, FAIL) @@ -1525,7 +1520,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, else fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Warning: Invalid heap address given, name not displayed!"); - H5G_ent_debug(f, sn->entry + u, stream, indent, fwidth, heap); + H5G_ent_debug(sn->entry + u, stream, indent, fwidth, heap); } /* end for */ } /* end if */ |