diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-09-06 17:36:26 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-09-06 17:36:26 (GMT) |
commit | 0b070ae114172588756d2c8732ccb7c89eb08ab6 (patch) | |
tree | bc63dbf62358e0f49460c59bf77e32a031045d3c /tools/h5ls | |
parent | a57f039a6aae04b8f91955e92ddbaa74cc78fc2b (diff) | |
download | hdf5-0b070ae114172588756d2c8732ccb7c89eb08ab6.zip hdf5-0b070ae114172588756d2c8732ccb7c89eb08ab6.tar.gz hdf5-0b070ae114172588756d2c8732ccb7c89eb08ab6.tar.bz2 |
HDFFV-10282 refactor out assert calls in tools
Diffstat (limited to 'tools/h5ls')
-rw-r--r-- | tools/h5ls/h5ls.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index a58b96b..e81a8eb 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1618,9 +1618,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 */ @@ -1630,23 +1630,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 */ } @@ -1847,7 +1846,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) } /* end if */ break; default: - HDassert(0); + h5tools_str_append(&buffer, "layout information not available"); break; } /* Print total raw storage size */ |