diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-08-23 21:12:40 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-08-23 21:12:40 (GMT) |
commit | b82ba32275f7ed998aafa68a1cecaab3e80323da (patch) | |
tree | 2e27f8701a0f4223a6a43c85087a963bf372b2d5 /tools/src/h5ls | |
parent | 1b647b18fee735086616bf99e1879e47bab0c72e (diff) | |
download | hdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.zip hdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.tar.gz hdf5-b82ba32275f7ed998aafa68a1cecaab3e80323da.tar.bz2 |
HDFFV-10282 refactor out assert calls in tools
Diffstat (limited to 'tools/src/h5ls')
-rw-r--r-- | tools/src/h5ls/h5ls.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index a181186..d397067 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1619,9 +1619,9 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) { if(hexdump_g) - p_type = H5Tcopy(type); + p_type = H5Tcopy(type); else - p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT); + p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT); if(p_type >= 0) { /* VL data special information */ @@ -1631,23 +1631,22 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; - temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - HDassert(temp_need == (hsize_t)((size_t)temp_need)); + temp_need = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); need = (size_t)temp_need; - buf = HDmalloc(need); - HDassert(buf); - if(H5Aread(attr, p_type, buf) >= 0) { - ctx.need_prefix = TRUE; - ctx.indent_level = 2; - ctx.cur_column = (size_t)curr_pos; - h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf); - } + if((buf = HDmalloc(need)) != NULL) { + if(H5Aread(attr, p_type, buf) >= 0) { + ctx.need_prefix = TRUE; + ctx.indent_level = 2; + ctx.cur_column = (size_t)curr_pos; + h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf); + } - /* Reclaim any VL memory, if necessary */ - if (vl_data) - H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf); - HDfree(buf); + HDfree(buf); + } H5Tclose(p_type); } /* end if */ } @@ -1875,7 +1874,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert(0); + h5tools_str_append(&buffer, "layout information not available"); break; } /* Print total raw storage size */ |