summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-12-12 18:40:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-12-12 18:40:09 (GMT)
commit47d88766dbee3c631c842639d44c362c2b7b8e44 (patch)
tree77058751c8bcb0260593674f609cb5df1224198c /src
parent6e9c0514fb45ddb358d36832237a3beace6ffb6b (diff)
downloadhdf5-47d88766dbee3c631c842639d44c362c2b7b8e44.zip
hdf5-47d88766dbee3c631c842639d44c362c2b7b8e44.tar.gz
hdf5-47d88766dbee3c631c842639d44c362c2b7b8e44.tar.bz2
[svn-r4706] Purpose:
Code cleanup Description: Tweaked internal error handling macros to reduce the size of the library's object code by about 10-20%. Also cleaned up some compiler warnings... Platforms tested: FreeBSD 4.4 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r--src/H5.c304
-rw-r--r--src/H5D.c24
-rw-r--r--src/H5Eprivate.h8
-rw-r--r--src/H5F.c16
-rw-r--r--src/H5G.c3
-rw-r--r--src/H5I.c51
-rw-r--r--src/H5Iprivate.h50
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5P.c2
-rw-r--r--src/H5Sall.c58
-rw-r--r--src/H5Shyper.c8
-rw-r--r--src/H5Smpio.c2
-rw-r--r--src/H5T.c2
-rw-r--r--src/H5private.h9
14 files changed, 265 insertions, 276 deletions
diff --git a/src/H5.c b/src/H5.c
index d8dbe14..451eb0d 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1725,157 +1725,158 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
} else if (obj<0) {
fprintf (out, "FAIL");
} else {
- switch (H5I_get_type (obj)) {
- case H5I_BADID:
- fprintf (out, "%ld (error)", (long)obj);
- break;
- case H5I_FILE:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "file")) {
- fprintf (out, " (file)");
- }
- break;
- case H5I_GROUP:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "group")) {
- fprintf (out, " (group)");
- }
- break;
- case H5I_DATATYPE:
- if (obj==H5T_NATIVE_SCHAR_g) {
- fprintf(out, "H5T_NATIVE_SCHAR");
- } else if (obj==H5T_NATIVE_UCHAR_g) {
- fprintf(out, "H5T_NATIVE_UCHAR");
- } else if (obj==H5T_NATIVE_SHORT_g) {
- fprintf(out, "H5T_NATIVE_SHORT");
- } else if (obj==H5T_NATIVE_USHORT_g) {
- fprintf(out, "H5T_NATIVE_USHORT");
- } else if (obj==H5T_NATIVE_INT_g) {
- fprintf(out, "H5T_NATIVE_INT");
- } else if (obj==H5T_NATIVE_UINT_g) {
- fprintf(out, "H5T_NATIVE_UINT");
- } else if (obj==H5T_NATIVE_LONG_g) {
- fprintf(out, "H5T_NATIVE_LONG");
- } else if (obj==H5T_NATIVE_ULONG_g) {
- fprintf(out, "H5T_NATIVE_ULONG");
- } else if (obj==H5T_NATIVE_LLONG_g) {
- fprintf(out, "H5T_NATIVE_LLONG");
- } else if (obj==H5T_NATIVE_ULLONG_g) {
- fprintf(out, "H5T_NATIVE_ULLONG");
- } else if (obj==H5T_NATIVE_FLOAT_g) {
- fprintf(out, "H5T_NATIVE_FLOAT");
- } else if (obj==H5T_NATIVE_DOUBLE_g) {
- fprintf(out, "H5T_NATIVE_DOUBLE");
- } else if (obj==H5T_NATIVE_LDOUBLE_g) {
- fprintf(out, "H5T_NATIVE_LDOUBLE");
- } else if (obj==H5T_IEEE_F32BE_g) {
- fprintf(out, "H5T_IEEE_F32BE");
- } else if (obj==H5T_IEEE_F32LE_g) {
- fprintf(out, "H5T_IEEE_F32LE");
- } else if (obj==H5T_IEEE_F64BE_g) {
- fprintf(out, "H5T_IEEE_F64BE");
- } else if (obj==H5T_IEEE_F64LE_g) {
- fprintf(out, "H5T_IEEE_F64LE");
- } else if (obj==H5T_STD_I8BE_g) {
- fprintf(out, "H5T_STD_I8BE");
- } else if (obj==H5T_STD_I8LE_g) {
- fprintf(out, "H5T_STD_I8LE");
- } else if (obj==H5T_STD_I16BE_g) {
- fprintf(out, "H5T_STD_I16BE");
- } else if (obj==H5T_STD_I16LE_g) {
- fprintf(out, "H5T_STD_I16LE");
- } else if (obj==H5T_STD_I32BE_g) {
- fprintf(out, "H5T_STD_I32BE");
- } else if (obj==H5T_STD_I32LE_g) {
- fprintf(out, "H5T_STD_I32LE");
- } else if (obj==H5T_STD_I64BE_g) {
- fprintf(out, "H5T_STD_I64BE");
- } else if (obj==H5T_STD_I64LE_g) {
- fprintf(out, "H5T_STD_I64LE");
- } else if (obj==H5T_STD_U8BE_g) {
- fprintf(out, "H5T_STD_U8BE");
- } else if (obj==H5T_STD_U8LE_g) {
- fprintf(out, "H5T_STD_U8LE");
- } else if (obj==H5T_STD_U16BE_g) {
- fprintf(out, "H5T_STD_U16BE");
- } else if (obj==H5T_STD_U16LE_g) {
- fprintf(out, "H5T_STD_U16LE");
- } else if (obj==H5T_STD_U32BE_g) {
- fprintf(out, "H5T_STD_U32BE");
- } else if (obj==H5T_STD_U32LE_g) {
- fprintf(out, "H5T_STD_U32LE");
- } else if (obj==H5T_STD_U64BE_g) {
- fprintf(out, "H5T_STD_U64BE");
- } else if (obj==H5T_STD_U64LE_g) {
- fprintf(out, "H5T_STD_U64LE");
- } else if (obj==H5T_STD_B8BE_g) {
- fprintf(out, "H5T_STD_B8BE");
- } else if (obj==H5T_STD_B8LE_g) {
- fprintf(out, "H5T_STD_B8LE");
- } else if (obj==H5T_STD_B16BE_g) {
- fprintf(out, "H5T_STD_B16BE");
- } else if (obj==H5T_STD_B16LE_g) {
- fprintf(out, "H5T_STD_B16LE");
- } else if (obj==H5T_STD_B32BE_g) {
- fprintf(out, "H5T_STD_B32BE");
- } else if (obj==H5T_STD_B32LE_g) {
- fprintf(out, "H5T_STD_B32LE");
- } else if (obj==H5T_STD_B64BE_g) {
- fprintf(out, "H5T_STD_B64BE");
- } else if (obj==H5T_STD_B64LE_g) {
- fprintf(out, "H5T_STD_B64LE");
- } else if (obj==H5T_C_S1_g) {
- fprintf(out, "H5T_C_S1");
- } else if (obj==H5T_FORTRAN_S1_g) {
- fprintf(out, "H5T_FORTRAN_S1");
- } else {
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "type")) {
- fprintf (out, " (type)");
- }
- }
- break;
- case H5I_DATASPACE:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "space")) {
- fprintf (out, " (space)");
- }
- /*Save the rank of simple data spaces for arrays*/
- {
- H5S_t *space = H5I_object(obj);
- if (H5S_SIMPLE==H5S_get_simple_extent_type(space)) {
- asize[argno] = H5S_get_simple_extent_ndims(space);
- }
- }
- break;
- case H5I_DATASET:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "dset")) {
- fprintf (out, " (dset)");
- }
- break;
- case H5I_ATTR:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp (argname, "attr")) {
- fprintf (out, " (attr)");
- }
- break;
- case H5I_TEMPBUF:
- fprintf(out, "%ld", (long)obj);
- if (HDstrcmp(argname, "tbuf")) {
- fprintf(out, " (tbuf");
- }
- break;
- case H5I_REFERENCE:
- fprintf(out, "%ld (reference)", (long)obj);
- break;
- case H5I_VFL:
- fprintf(out, "%ld (file driver)", (long)obj);
- break;
- default:
- fprintf(out, "%ld", (long)obj);
- fprintf (out, " (unknown class)");
- break;
+ switch (H5I_GROUP(obj)) { /* Use internal H5I macro instead of function call */
+ case H5I_BADID:
+ fprintf (out, "%ld (error)", (long)obj);
+ break;
+ case H5I_FILE:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "file")) {
+ fprintf (out, " (file)");
+ }
+ break;
+ case H5I_GROUP:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "group")) {
+ fprintf (out, " (group)");
+ }
+ break;
+ case H5I_DATATYPE:
+ if (obj==H5T_NATIVE_SCHAR_g) {
+ fprintf(out, "H5T_NATIVE_SCHAR");
+ } else if (obj==H5T_NATIVE_UCHAR_g) {
+ fprintf(out, "H5T_NATIVE_UCHAR");
+ } else if (obj==H5T_NATIVE_SHORT_g) {
+ fprintf(out, "H5T_NATIVE_SHORT");
+ } else if (obj==H5T_NATIVE_USHORT_g) {
+ fprintf(out, "H5T_NATIVE_USHORT");
+ } else if (obj==H5T_NATIVE_INT_g) {
+ fprintf(out, "H5T_NATIVE_INT");
+ } else if (obj==H5T_NATIVE_UINT_g) {
+ fprintf(out, "H5T_NATIVE_UINT");
+ } else if (obj==H5T_NATIVE_LONG_g) {
+ fprintf(out, "H5T_NATIVE_LONG");
+ } else if (obj==H5T_NATIVE_ULONG_g) {
+ fprintf(out, "H5T_NATIVE_ULONG");
+ } else if (obj==H5T_NATIVE_LLONG_g) {
+ fprintf(out, "H5T_NATIVE_LLONG");
+ } else if (obj==H5T_NATIVE_ULLONG_g) {
+ fprintf(out, "H5T_NATIVE_ULLONG");
+ } else if (obj==H5T_NATIVE_FLOAT_g) {
+ fprintf(out, "H5T_NATIVE_FLOAT");
+ } else if (obj==H5T_NATIVE_DOUBLE_g) {
+ fprintf(out, "H5T_NATIVE_DOUBLE");
+ } else if (obj==H5T_NATIVE_LDOUBLE_g) {
+ fprintf(out, "H5T_NATIVE_LDOUBLE");
+ } else if (obj==H5T_IEEE_F32BE_g) {
+ fprintf(out, "H5T_IEEE_F32BE");
+ } else if (obj==H5T_IEEE_F32LE_g) {
+ fprintf(out, "H5T_IEEE_F32LE");
+ } else if (obj==H5T_IEEE_F64BE_g) {
+ fprintf(out, "H5T_IEEE_F64BE");
+ } else if (obj==H5T_IEEE_F64LE_g) {
+ fprintf(out, "H5T_IEEE_F64LE");
+ } else if (obj==H5T_STD_I8BE_g) {
+ fprintf(out, "H5T_STD_I8BE");
+ } else if (obj==H5T_STD_I8LE_g) {
+ fprintf(out, "H5T_STD_I8LE");
+ } else if (obj==H5T_STD_I16BE_g) {
+ fprintf(out, "H5T_STD_I16BE");
+ } else if (obj==H5T_STD_I16LE_g) {
+ fprintf(out, "H5T_STD_I16LE");
+ } else if (obj==H5T_STD_I32BE_g) {
+ fprintf(out, "H5T_STD_I32BE");
+ } else if (obj==H5T_STD_I32LE_g) {
+ fprintf(out, "H5T_STD_I32LE");
+ } else if (obj==H5T_STD_I64BE_g) {
+ fprintf(out, "H5T_STD_I64BE");
+ } else if (obj==H5T_STD_I64LE_g) {
+ fprintf(out, "H5T_STD_I64LE");
+ } else if (obj==H5T_STD_U8BE_g) {
+ fprintf(out, "H5T_STD_U8BE");
+ } else if (obj==H5T_STD_U8LE_g) {
+ fprintf(out, "H5T_STD_U8LE");
+ } else if (obj==H5T_STD_U16BE_g) {
+ fprintf(out, "H5T_STD_U16BE");
+ } else if (obj==H5T_STD_U16LE_g) {
+ fprintf(out, "H5T_STD_U16LE");
+ } else if (obj==H5T_STD_U32BE_g) {
+ fprintf(out, "H5T_STD_U32BE");
+ } else if (obj==H5T_STD_U32LE_g) {
+ fprintf(out, "H5T_STD_U32LE");
+ } else if (obj==H5T_STD_U64BE_g) {
+ fprintf(out, "H5T_STD_U64BE");
+ } else if (obj==H5T_STD_U64LE_g) {
+ fprintf(out, "H5T_STD_U64LE");
+ } else if (obj==H5T_STD_B8BE_g) {
+ fprintf(out, "H5T_STD_B8BE");
+ } else if (obj==H5T_STD_B8LE_g) {
+ fprintf(out, "H5T_STD_B8LE");
+ } else if (obj==H5T_STD_B16BE_g) {
+ fprintf(out, "H5T_STD_B16BE");
+ } else if (obj==H5T_STD_B16LE_g) {
+ fprintf(out, "H5T_STD_B16LE");
+ } else if (obj==H5T_STD_B32BE_g) {
+ fprintf(out, "H5T_STD_B32BE");
+ } else if (obj==H5T_STD_B32LE_g) {
+ fprintf(out, "H5T_STD_B32LE");
+ } else if (obj==H5T_STD_B64BE_g) {
+ fprintf(out, "H5T_STD_B64BE");
+ } else if (obj==H5T_STD_B64LE_g) {
+ fprintf(out, "H5T_STD_B64LE");
+ } else if (obj==H5T_C_S1_g) {
+ fprintf(out, "H5T_C_S1");
+ } else if (obj==H5T_FORTRAN_S1_g) {
+ fprintf(out, "H5T_FORTRAN_S1");
+ } else {
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "type")) {
+ fprintf (out, " (type)");
+ }
+ }
+ break;
+ case H5I_DATASPACE:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "space")) {
+ fprintf (out, " (space)");
+ }
+ /* Save the rank of simple data spaces for arrays */
+ /* This may generate recursive call to the library... -QAK */
+ {
+ H5S_t *space = H5I_object(obj);
+ if (H5S_SIMPLE==H5S_get_simple_extent_type(space)) {
+ asize[argno] = H5S_get_simple_extent_ndims(space);
+ }
+ }
+ break;
+ case H5I_DATASET:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "dset")) {
+ fprintf (out, " (dset)");
+ }
+ break;
+ case H5I_ATTR:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp (argname, "attr")) {
+ fprintf (out, " (attr)");
+ }
+ break;
+ case H5I_TEMPBUF:
+ fprintf(out, "%ld", (long)obj);
+ if (HDstrcmp(argname, "tbuf")) {
+ fprintf(out, " (tbuf");
+ }
+ break;
+ case H5I_REFERENCE:
+ fprintf(out, "%ld (reference)", (long)obj);
+ break;
+ case H5I_VFL:
+ fprintf(out, "%ld (file driver)", (long)obj);
+ break;
+ default:
+ fprintf(out, "%ld", (long)obj);
+ fprintf (out, " (unknown class)");
+ break;
}
}
}
@@ -2091,6 +2092,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
H5P_genclass_t *pclass;
/* Get the class name and print it */
+ /* This may generate recursive call to the library... -QAK */
if(NULL != (pclass = H5I_object(pclass_id)) &&
(class_name=H5P_get_class_name(pclass))!=NULL) {
fprintf (out, class_name);
diff --git a/src/H5D.c b/src/H5D.c
index 865a732..c4bd450 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1977,7 +1977,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5S_sel_iter_t mem_iter; /*mem selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iter info*/
- herr_t ret_value = FAIL; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
@@ -1998,7 +1998,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5O_pline_t pline;
H5O_efl_t efl;
H5O_fill_t fill;
- H5P_genplist_t *dx_plist; /* Property list */
+ H5P_genplist_t *dx_plist=NULL; /* Property list */
H5P_genplist_t *dc_plist; /* Property list */
@@ -2136,7 +2136,7 @@ printf("%s: check 1.1, \n",FUNC);
H5T_get_size(dataset->type);
sconv->stats[1].read_ncalls++;
#endif
- goto succeed;
+ HGOTO_DONE(SUCCEED);
}
#ifdef H5D_DEBUG
if (H5DEBUG(D)) {
@@ -2382,10 +2382,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
#endif /* QAK */
}
- succeed:
- ret_value = SUCCEED;
-
- done:
+done:
#ifdef H5_HAVE_PARALLEL
/* restore xfer_mode due to the kludge */
if (doing_mpio && xfer_mode_changed){
@@ -2408,6 +2405,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
H5I_dec_ref(src_id);
if (dst_id >= 0)
H5I_dec_ref(dst_id);
+ assert(dx_plist);
if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
H5FL_BLK_FREE(type_conv,tconv_buf);
if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
@@ -2468,7 +2466,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iteration info*/
- herr_t ret_value = FAIL; /*return value */
+ herr_t ret_value = SUCCEED; /*return value */
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
@@ -2489,7 +2487,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
H5O_pline_t pline;
H5O_efl_t efl;
H5O_fill_t fill;
- H5P_genplist_t *dx_plist; /* Property list */
+ H5P_genplist_t *dx_plist=NULL; /* Property list */
H5P_genplist_t *dc_plist; /* Property list */
FUNC_ENTER(H5D_write, FAIL);
@@ -2647,7 +2645,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
sconv->stats[0].write_nbytes += nelmts * H5T_get_size(mem_type);
sconv->stats[0].write_ncalls++;
#endif
- goto succeed;
+ HGOTO_DONE(SUCCEED);
}
#ifdef H5D_DEBUG
if (H5DEBUG(D)) {
@@ -2874,10 +2872,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
"unable to update modification time");
}
- succeed:
- ret_value = SUCCEED;
-
- done:
+done:
#ifdef H5_HAVE_PARALLEL
/* restore xfer_mode due to the kludge */
if (doing_mpio && xfer_mode_changed){
@@ -2900,6 +2895,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
H5I_dec_ref(src_id);
if (dst_id >= 0)
H5I_dec_ref(dst_id);
+ assert(dx_plist);
if (tconv_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_TCONV_BUF_NAME))
H5FL_BLK_FREE(type_conv,tconv_buf);
if (bkg_buf && NULL==H5P_peek_voidp(dx_plist,H5D_XFER_BKGR_BUF_NAME))
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 8003730..a201111 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -38,15 +38,10 @@
*/
#define HRETURN_ERROR(maj, min, ret_val, str) { \
HERROR (maj, min, str); \
- PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \
- H5TRACE_RETURN(ret_val); \
if (H5_IS_API(FUNC) && H5E_auto_g) { \
(H5E_auto_g)(H5E_auto_data_g); \
} \
- H5_API_UNLOCK_BEGIN \
- H5_API_UNLOCK_END \
- H5_API_SET_CANCEL \
- return (ret_val); \
+ HRETURN(ret_val); \
}
/*
@@ -72,7 +67,6 @@
*/
#define HGOTO_ERROR(maj, min, ret_val, str) { \
HERROR (maj, min, str); \
- H5TRACE_RETURN(ret_val); \
if (H5_IS_API(FUNC) && H5E_auto_g) { \
(H5E_auto_g)(H5E_auto_data_g); \
} \
diff --git a/src/H5F.c b/src/H5F.c
index b98eae8..4e1e262 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -632,7 +632,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5F_flush_all_cb(H5F_t *f, hid_t fid, const void *_invalidate)
+H5F_flush_all_cb(H5F_t *f, hid_t UNUSED fid, const void *_invalidate)
{
hbool_t invalidate = *((const hbool_t*)_invalidate);
H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE);
@@ -1064,7 +1064,9 @@ H5F_get_objects(H5F_t *f, unsigned types, hid_t *obj_id_list,
H5I_search(H5I_DATATYPE, (H5I_search_func_t)H5F_get_objects_cb, olist);
}
+#ifdef LATER
done:
+#endif /* LATER */
if(olist!=NULL)
H5MM_xfree(olist);
FUNC_LEAVE(ret_value);
@@ -1118,12 +1120,14 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
case H5I_DATATYPE:
ent = H5T_entof((H5T_t*)obj_ptr);
break;
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "unknown data object");
}
- if( (!olist->shared && olist->obj_type==H5I_DATATYPE &&
- H5T_is_immutable((H5T_t*)obj_ptr)==FALSE)
- || (!olist->shared && olist->obj_type!=H5I_DATATYPE)
- || (ent && ent->file->shared == olist->shared) ) {
+ if( (!olist->shared && olist->obj_type==H5I_DATATYPE && H5T_is_immutable((H5T_t*)obj_ptr)==FALSE)
+ || (!olist->shared && olist->obj_type!=H5I_DATATYPE)
+ || (ent && ent->file->shared == olist->shared) ) {
if(olist->obj_id_list) {
olist->obj_id_list[olist->list_index] = obj_id;
olist->list_index++;
@@ -1156,7 +1160,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5F_equal(void *_haystack, UNUSED hid_t id, const void *_needle)
+H5F_equal(void *_haystack, hid_t UNUSED id, const void *_needle)
{
H5F_t *haystack = (H5F_t*)_haystack;
const H5FD_t *needle = (const H5FD_t*)_needle;
diff --git a/src/H5G.c b/src/H5G.c
index 80e17f0..16476e8 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -807,8 +807,7 @@ H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*), const char *_desc)
H5G_type_g[i].isa = isa;
H5MM_xfree(H5G_type_g[i].desc);
H5G_type_g[i].desc = desc;
- ret_value = SUCCEED;
- goto done;
+ HGOTO_DONE(SUCCEED);
}
}
diff --git a/src/H5I.c b/src/H5I.c
index 65815a4..1f47030 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -43,60 +43,9 @@ static int interface_initialize_g = 0;
#define INTERFACE_INIT H5I_init_interface
static herr_t H5I_init_interface(void);
-/*
- * Define the following macro for fast hash calculations (but limited
- * hash sizes)
- */
-#define HASH_SIZE_POWER_2
-
-/* Define the following macro for atom caching over all the atoms */
-#define IDS_ARE_CACHED
-
/*-------------------- Locally scoped variables -----------------------------*/
#ifdef IDS_ARE_CACHED
-# define ID_CACHE_SIZE 4 /*# of previous atoms cached */
-#endif
-
-/*
- * Number of bits to use for Group ID in each atom. Increase if H5I_NGROUPS
- * becomes too large (an assertion would fail in H5I_init_interface). This is
- * the only number that must be changed since all other bit field sizes and
- * masks are calculated from GROUP_BITS.
- */
-#define GROUP_BITS 5
-#define GROUP_MASK ((1<<GROUP_BITS)-1)
-
-/*
- * Number of bits to use for the Atom index in each atom (assumes 8-bit
- * bytes). We don't use the sign bit.
- */
-#define ID_BITS ((sizeof(hid_t)*8)-(GROUP_BITS+1))
-#define ID_MASK ((1<<ID_BITS)-1)
-
-/* Map an atom to a Group number */
-#define H5I_GROUP(a) ((H5I_type_t)(((hid_t)(a)>>ID_BITS) & GROUP_MASK))
-
-
-#ifdef HASH_SIZE_POWER_2
-/*
- * Map an ID to a hash location (assumes s is a power of 2 and smaller
- * than the ID_MASK constant).
- */
-# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1)))
-# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0)
-#else
-/*
- * Map an ID to a hash location.
- */
-# define H5I_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s))
-#endif
-
-/* Combine a Group number and an atom index into an atom */
-#define H5I_MAKE(g,i) ((((hid_t)(g)&GROUP_MASK)<<ID_BITS)| \
- ((hid_t)(i)&ID_MASK))
-
-#ifdef IDS_ARE_CACHED
/* ID Cache */
static H5I_id_info_t *H5I_cache_g[ID_CACHE_SIZE];
#endif
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index bb289a0..a928590 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -41,6 +41,56 @@
#define H5I_GENPROPOBJ_HASHSIZE 128
/*
+ * Define the following macro for fast hash calculations (but limited
+ * hash sizes)
+ */
+#define HASH_SIZE_POWER_2
+
+/* Define the following macro for atom caching over all the atoms */
+#define IDS_ARE_CACHED
+
+#ifdef IDS_ARE_CACHED
+# define ID_CACHE_SIZE 4 /*# of previous atoms cached */
+#endif
+
+/*
+ * Number of bits to use for Group ID in each atom. Increase if H5I_NGROUPS
+ * becomes too large (an assertion would fail in H5I_init_interface). This is
+ * the only number that must be changed since all other bit field sizes and
+ * masks are calculated from GROUP_BITS.
+ */
+#define GROUP_BITS 5
+#define GROUP_MASK ((1<<GROUP_BITS)-1)
+
+/*
+ * Number of bits to use for the Atom index in each atom (assumes 8-bit
+ * bytes). We don't use the sign bit.
+ */
+#define ID_BITS ((sizeof(hid_t)*8)-(GROUP_BITS+1))
+#define ID_MASK ((1<<ID_BITS)-1)
+
+/* Map an atom to a Group number */
+#define H5I_GROUP(a) ((H5I_type_t)(((hid_t)(a)>>ID_BITS) & GROUP_MASK))
+
+#ifdef HASH_SIZE_POWER_2
+/*
+ * Map an ID to a hash location (assumes s is a power of 2 and smaller
+ * than the ID_MASK constant).
+ */
+# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1)))
+# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0)
+#else
+/*
+ * Map an ID to a hash location.
+ */
+# define H5I_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s))
+#endif
+
+/* Combine a Group number and an atom index into an atom */
+#define H5I_MAKE(g,i) ((((hid_t)(g)&GROUP_MASK)<<ID_BITS)| \
+ ((hid_t)(i)&ID_MASK))
+
+/*
* Function for freeing objects. This function will be called with an object
* ID group number (object type) and a pointer to the object. The function
* should free the object and return non-negative to indicate that the object
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 451efbe..a6267a1 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -411,7 +411,7 @@ H5O_efl_read (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr,
#ifndef NDEBUG
hsize_t tempto_read;
#endif /* NDEBUG */
- hsize_t skip;
+ hsize_t skip=0;
haddr_t cur;
ssize_t n;
herr_t ret_value = FAIL;
@@ -508,7 +508,7 @@ H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr,
hsize_t tempto_write;
#endif /* NDEBUG */
haddr_t cur;
- hsize_t skip;
+ hsize_t skip=0;
herr_t ret_value = FAIL;
FUNC_ENTER (H5O_efl_write, FAIL);
diff --git a/src/H5P.c b/src/H5P.c
index 952c9a9..aa88694 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -7813,7 +7813,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t *src_pclass, const char *name)
+H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t UNUSED *src_pclass, const char *name)
{
H5P_genprop_t *prop; /* Temporary property pointer */
herr_t ret_value=SUCCEED; /* return value */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 99349cc..fed5d18 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -284,7 +284,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
*/
static hsize_t
H5S_all_mgath (const void *_buf, size_t elmt_size,
- const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
+ const H5S_t UNUSED *mem_space, H5S_sel_iter_t *mem_iter,
hsize_t nelmts, void *tconv_buf/*out*/)
{
const uint8_t *buf=(const uint8_t*)_buf; /* Get local copies for address arithmetic */
@@ -335,7 +335,7 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
*/
static herr_t
H5S_all_mscat (const void *tconv_buf, size_t elmt_size,
- const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
+ const H5S_t UNUSED *mem_space, H5S_sel_iter_t *mem_iter,
hsize_t nelmts, void *_buf/*out*/)
{
uint8_t *buf=(uint8_t *)_buf;
@@ -411,6 +411,7 @@ H5S_all_read(H5F_t *f, const H5O_layout_t *layout, const H5O_pline_t *pline,
int i;
size_t down_size[H5O_LAYOUT_NDIMS];
hsize_t acc;
+ herr_t ret_value=SUCCEED;
FUNC_ENTER(H5S_all_read, FAIL);
*must_convert = TRUE;
@@ -420,11 +421,11 @@ printf("%s: check 1.0\n",FUNC);
#endif /* QAK */
/* Check whether we can handle this */
if (H5S_SIMPLE!=mem_space->extent.type)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
if (H5S_SIMPLE!=file_space->extent.type)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
if (mem_space->extent.u.simple.rank!=file_space->extent.u.simple.rank)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Check for a single hyperslab block defined in memory dataspace */
if (mem_space->select.type==H5S_SEL_HYPERSLABS) {
@@ -435,7 +436,7 @@ printf("%s: check 1.0\n",FUNC);
count*=mem_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end if */
else {
/* Get the pointer to the hyperslab spans to check */
@@ -445,7 +446,7 @@ printf("%s: check 1.0\n",FUNC);
while(mem_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(mem_span->next!=NULL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Advance to the next span, if it's available */
if(mem_span->down==NULL)
@@ -460,7 +461,7 @@ printf("%s: check 1.0\n",FUNC);
} /* end if */
else
if(mem_space->select.type!=H5S_SEL_ALL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Check for a single hyperslab block defined in file dataspace */
if (file_space->select.type==H5S_SEL_HYPERSLABS) {
@@ -471,7 +472,7 @@ printf("%s: check 1.0\n",FUNC);
count*=file_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end if */
else {
/* Get the pointer to the hyperslab spans to check */
@@ -481,7 +482,7 @@ printf("%s: check 1.0\n",FUNC);
while(file_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(file_span->next!=NULL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Advance to the next span, if it's available */
if(file_span->down==NULL)
@@ -496,7 +497,7 @@ printf("%s: check 1.0\n",FUNC);
} /* end if */
else
if(file_space->select.type!=H5S_SEL_ALL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Get information about memory and file */
for (u=0; u<mem_space->extent.u.simple.rank; u++) {
@@ -535,7 +536,7 @@ printf("%s: check 1.0\n",FUNC);
} /* end else */
if (mem_size!=file_size)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
size[u] = file_size;
file_offset[u] = file_off;
@@ -608,7 +609,7 @@ printf("%s: check 1.0\n",FUNC);
} /* end if */
else {
/* Non-contiguous hyperslab block */
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end else */
} /* end if */
@@ -624,12 +625,12 @@ for (u=0; u<=mem_space->extent.u.simple.rank; u++)
/* Read data from the file */
if (H5F_arr_read(f, dxpl_id, layout, pline, NULL, efl, size,
size, mem_offset, file_offset, buf/*out*/)<0) {
- HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL,
"unable to read data from the file");
}
*must_convert = FALSE;
-fall_through:
+done:
FUNC_LEAVE(SUCCEED);
}
@@ -679,17 +680,18 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
int i;
size_t down_size[H5O_LAYOUT_NDIMS];
hsize_t acc;
+ herr_t ret_value=SUCCEED;
FUNC_ENTER(H5S_all_write, FAIL);
*must_convert = TRUE;
/* Check whether we can handle this */
if (H5S_SIMPLE!=mem_space->extent.type)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
if (H5S_SIMPLE!=file_space->extent.type)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
if (mem_space->extent.u.simple.rank!=file_space->extent.u.simple.rank)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Check for a single hyperslab block defined in memory dataspace */
if (mem_space->select.type==H5S_SEL_HYPERSLABS) {
@@ -700,7 +702,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
count*=mem_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end if */
else {
/* Get the pointer to the hyperslab spans to check */
@@ -710,7 +712,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
while(mem_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(mem_span->next!=NULL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Advance to the next span, if it's available */
if(mem_span->down==NULL)
@@ -725,7 +727,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
} /* end if */
else
if(mem_space->select.type!=H5S_SEL_ALL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Check for a single hyperslab block defined in file dataspace */
if (file_space->select.type==H5S_SEL_HYPERSLABS) {
@@ -736,7 +738,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
count*=file_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end if */
else {
/* Get the pointer to the hyperslab spans to check */
@@ -746,7 +748,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
while(file_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(file_span->next!=NULL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Advance to the next span, if it's available */
if(file_span->down==NULL)
@@ -761,7 +763,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
} /* end if */
else
if(file_space->select.type!=H5S_SEL_ALL)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
/* Get information about memory and file */
for (u=0; u<mem_space->extent.u.simple.rank; u++) {
@@ -800,7 +802,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
} /* end else */
if (mem_size!=file_size)
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
size[u] = file_size;
file_offset[u] = file_off;
@@ -873,20 +875,20 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
} /* end if */
else {
/* Non-contiguous hyperslab block */
- goto fall_through;
+ HGOTO_DONE(SUCCEED);
} /* end else */
} /* end if */
/* Write data to the file */
if (H5F_arr_write(f, dxpl_id, layout, pline, NULL, efl, size,
size, mem_offset, file_offset, buf)<0) {
- HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"unable to write data to the file");
}
*must_convert = FALSE;
-fall_through:
+done:
FUNC_LEAVE(SUCCEED);
}
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 8be16e9..7e11f7e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -410,7 +410,7 @@ H5S_hyper_fread (H5F_t *f, const struct H5O_layout_t *layout,
int curr_dim; /* Current dimension being operated on */
int ndims; /* Number of dimensions of dataset */
hsize_t loc_off; /* Element offset in the dataspace */
- size_t span_size; /* Number of bytes in current span to actually process */
+ size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_bytes_left; /* Number of bytes left to process */
int i; /* Index variable */
size_t *seq_len_arr=NULL; /* Array of sequence lengths */
@@ -1509,7 +1509,7 @@ H5S_hyper_fwrite (H5F_t *f, const struct H5O_layout_t *layout,
int curr_dim; /* Current dimension being operated on */
int ndims; /* Number of dimensions of dataset */
hsize_t loc_off; /* Element offset in the dataspace */
- size_t span_size; /* Number of bytes in current span to actually process */
+ size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_bytes_left; /* Number of bytes left to process */
int i; /* Index variable */
size_t *seq_len_arr=NULL; /* Array of sequence lengths */
@@ -2599,7 +2599,7 @@ H5S_hyper_mread (const void *_buf, size_t elmt_size, const H5S_t *space,
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int curr_dim; /* Current dimension being operated on */
int ndims; /* Number of dimensions of dataset */
- size_t span_size; /* Number of bytes in current span to actually process */
+ size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_bytes_left; /* Number of bytes left to process */
int i; /* Index variable */
hssize_t ret_value=FAIL;
@@ -3472,7 +3472,7 @@ H5S_hyper_mwrite (const void *_tconv_buf, size_t elmt_size, const H5S_t *space,
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int curr_dim; /* Current dimension being operated on */
int ndims; /* Number of dimensions of dataset */
- size_t span_size; /* Number of bytes in current span to actually process */
+ size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_bytes_left; /* Number of bytes left to process */
int i; /* Index variable */
hssize_t ret_value=FAIL;
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 89eadd6..a473c8c 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -424,7 +424,7 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size,
/* fill in the remaining return values */
*count = 1; /* only have to move one of these suckers! */
*is_derived_type = 1;
- goto done;
+ HGOTO_DONE(SUCCEED);
empty:
/* special case: empty hyperslab */
diff --git a/src/H5T.c b/src/H5T.c
index f0d11eb..c778f26 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1924,7 +1924,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5T_unlock_cb (void *_dt, hid_t id, const void * UNUSED key)
+H5T_unlock_cb (void *_dt, hid_t UNUSED id, const void * UNUSED key)
{
H5T_t *dt = (H5T_t *)_dt;
diff --git a/src/H5private.h b/src/H5private.h
index 672098a..9888bd9 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1024,7 +1024,6 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */
#define FUNC_ENTER_INIT(func_name,interface_init_func,err) { \
CONSTR (FUNC, #func_name); \
PABLO_SAVE (ID_ ## func_name) \
- static unsigned know_api=0, is_api=0; \
H5TRACE_DECL; \
\
PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \
@@ -1055,14 +1054,8 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */
} \
} \
\
- /* Check if we know this is an API function yet or not */ \
- if(!know_api) { \
- know_api=1; \
- is_api=H5_IS_API(FUNC); \
- } \
- \
/* Clear thread error stack entering public functions */ \
- if (is_api && H5E_clearable_g) { \
+ if (H5_IS_API(FUNC) && H5E_clearable_g) { \
H5E_clear (); \
} \
{