diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-28 05:02:26 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-28 20:08:04 (GMT) |
commit | 2cbf31cb3ad8032fb1915c783dc52a2050aaf7da (patch) | |
tree | d88ce3a7584792894bd073df1f2290f22eb69daa /tools/lib/h5diff_attr.c | |
parent | 34a68acc934800d6b8c9a51c2ce91155b3178111 (diff) | |
download | hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.zip hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.tar.gz hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.tar.bz2 |
Refactor tools library error handling macros
Diffstat (limited to 'tools/lib/h5diff_attr.c')
-rw-r--r-- | tools/lib/h5diff_attr.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 40a3b01..6b1857f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -153,43 +153,43 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attrs_t *table_lp = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat); if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc1id=%d", oinfo1.num_attrs); + H5TOOLS_DEBUG("H5Oget_info2 loc1id=%d", oinfo1.num_attrs); if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc2id=%d", oinfo2.num_attrs); + H5TOOLS_DEBUG("H5Oget_info2 loc2id=%d", oinfo2.num_attrs); table_attrs_init(&table_lp); if (table_lp == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "Table allocation failed"); /*-------------------------------------------------- * build the list */ while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); /* criteria is string compare */ cmp = HDstrcmp(name1, name2); @@ -227,16 +227,16 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 1; infile[1] = 0; while(curr1 < oinfo1.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #1 name - %s", name1); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #1 name - %s", name1); table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; @@ -251,15 +251,15 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 0; infile[1] = 1; while(curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #2 name - %s", name2); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #2 name - %s", name2); table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; @@ -299,9 +299,9 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs end - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -343,52 +343,52 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const int j; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data start - errstat:%d", opts->err_stat); /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if((ftype2_id = H5Aget_type(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if (H5Tget_class(ftype1_id) == H5T_REFERENCE) { if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); } else { if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type first attribute ftype failed"); } if (H5Tget_class(ftype2_id) == H5T_REFERENCE) { if((mtype2_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); } else { if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type second attribute ftype failed"); } if((msize1 = H5Tget_size(mtype1_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_size first attribute mtype failed"); if((msize2 = H5Tget_size(mtype2_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_size second attribute mtype failed"); /* get the dataspace */ if((space1_id = H5Aget_space(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_space first attribute failed"); if((space2_id = H5Aget_space(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_space second attribute failed"); /* get dimensions */ if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims first attribute failed"); if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims second attribute failed"); /*---------------------------------------------------------------------- * check for comparable TYPE and SPACE *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE"); + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE"); /* pass dims1 and dims2 for maxdims as well since attribute's maxdims * are always same */ @@ -398,9 +398,9 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const *------------------------------------------------------------------ */ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); + H5TOOLS_GOTO_ERROR(1, "match_up_memsize failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data read"); + H5TOOLS_DEBUG("diff_attr_data read"); /*--------------------------------------------------------------------- * read *---------------------------------------------------------------------- @@ -413,18 +413,18 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "buffer allocation failed"); } if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { parallel_print("Failed reading attribute1 %s\n", name1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); } else buf1hasdata = TRUE; if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { parallel_print("Failed reading attribute2 %s\n", name2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); } else buf2hasdata = TRUE; @@ -437,7 +437,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const * array compare *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data array compare %s - %s", name1, name1); + H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1); /* always print name */ /* verbose (-v) and report (-r) mode */ @@ -465,7 +465,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const } /* end if */ } /* end else */ } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); /*---------------------------------------------------------------------- * close @@ -485,17 +485,17 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = NULL; if(H5Tclose(ftype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Tclose(ftype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if(H5Sclose(space1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Sclose(space2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if(H5Tclose(mtype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose first attribute mtype failed"); if(H5Tclose(mtype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose second attribute mtype failed"); done: opts->err_stat = opts->err_stat | ret_value; @@ -520,9 +520,9 @@ done: H5Sclose(space2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data end - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -553,43 +553,43 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p table_attrs_t *match_list_attrs = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr start - errstat:%d", opts->err_stat); if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed"); + H5TOOLS_GOTO_ERROR(1, "build_match_list_attrs failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat); /* if detect any unique extra attr */ if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr attributes only in one file"); + H5TOOLS_DEBUG("diff_attr attributes only in one file"); /* exit will be 1 */ opts->contents = 0; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g,"match_list_attrs info - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat); for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) { name1 = name2 = match_list_attrs->attrs[u].name; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr name - %s", name1); + H5TOOLS_DEBUG("diff_attr name - %s", name1); /*-------------- * attribute 1 */ if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aopen first attribute failed"); /*-------------- * attribute 2 */ if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aopen second attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr got attributes"); + H5TOOLS_DEBUG("diff_attr got attributes"); nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts); if(H5Aclose(attr1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); nfound_total += nfound; } @@ -605,8 +605,8 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_DEBUG("diff_attr end - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound_total; } |