diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2010-11-11 16:51:59 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2010-11-11 16:51:59 (GMT) |
commit | ed45b7472e3260a83bd28f81af96f6b04523bb5b (patch) | |
tree | 987a07b5182222a38b2287e586e9d3830dc94afb /tools/lib/h5diff_array.c | |
parent | 40d56dd20cc4c1dfad22596135d505cd19915a45 (diff) | |
download | hdf5-ed45b7472e3260a83bd28f81af96f6b04523bb5b.zip hdf5-ed45b7472e3260a83bd28f81af96f6b04523bb5b.tar.gz hdf5-ed45b7472e3260a83bd28f81af96f6b04523bb5b.tar.bz2 |
[svn-r19759] Purpose:
Fix compile error for Windows from previous checkin r19757.
Description:
Previous log:
Improve h5diff performance.
The following changes for improving h5diff performance:
1) use HDmemcmp() before comparing each elements
(memcmp() is very fast at both linew and jam)
2) replace the expensive H5Tequals() calls
3) retrieve datatype information at dataset level not each element level
for compound datasets
Tested:
jam (linux32-LE), Windows
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r-- | tools/lib/h5diff_array.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index e137db2..353b37b 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -6079,6 +6079,8 @@ static void h5diff_print_char(char ch) */ static void set_comp_members(hid_t tid, mcomp_t *members) { + int i; + if (tid <=0 || !members) return; @@ -6094,11 +6096,13 @@ static void set_comp_members(hid_t tid, mcomp_t *members) members->offsets = HDcalloc(members->n, sizeof(size_t)); members->m = HDcalloc(members->n, sizeof(mcomp_t *)); - for (int i=0; i< members->n; i++) { + for (i=0; i< members->n; i++) + { members->ids[i] = H5Tget_member_type( tid, i ); members->flags[i] = H5Tis_variable_str( members->ids[i] ); members->offsets[i] = H5Tget_member_offset( tid, i ); - if (H5Tget_class( members->ids[i])==H5T_COMPOUND) { + if (H5Tget_class( members->ids[i])==H5T_COMPOUND) + { members->m[i] = (mcomp_t *)HDmalloc(sizeof(mcomp_t)); set_comp_members(members->ids[i], members->m[i]); } @@ -6112,11 +6116,15 @@ static void set_comp_members(hid_t tid, mcomp_t *members) */ static void free_comp_members(mcomp_t *members) { + int i; + if (!members || members->n<=0 || !members->ids) return; - for (int i=0; i<members->n; i++) { - if (members->m[i]) { + for (i=0; i<members->n; i++) + { + if (members->m[i]) + { free_comp_members(members->m[i]); HDfree(members->m[i]); } |