summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-24 00:16:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-24 00:16:49 (GMT)
commit5032b2e7df430fffd5941508cfc6276474f96718 (patch)
treec130eb972eaeba3b981e324a682ca4f2844f4cde /test
parent45ac4641615d1b0e92c903b0f3fafd154aa1ff31 (diff)
downloadhdf5-5032b2e7df430fffd5941508cfc6276474f96718.zip
hdf5-5032b2e7df430fffd5941508cfc6276474f96718.tar.gz
hdf5-5032b2e7df430fffd5941508cfc6276474f96718.tar.bz2
[svn-r12806] Description:
Reduce memory usage for common cases of I/O pipeline filter memory usage. Also, clean up some more code... Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 8508b37..3dae7f0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -5620,72 +5620,72 @@ error:
static herr_t
auxread_fdata(hid_t fid, const char *name)
{
- hid_t dset_id=-1; /* dataset ID */
- hid_t dcpl_id=-1; /* dataset creation property list ID */
- hid_t space_id=-1; /* space ID */
- hid_t ftype_id=-1; /* file data type ID */
- hid_t mtype_id=-1; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- void *buf=NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- int i;
-
- if ((dset_id=H5Dopen(fid,name))<0)
- goto error;
- if ((space_id=H5Dget_space(dset_id))<0)
- goto error;
- if ((ftype_id=H5Dget_type (dset_id))<0)
- goto error;
- if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
- goto error;
- if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
- goto error;
- HDmemset(dims, 0, sizeof dims);
- if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
- goto error;
- nelmts=1;
- for (i=0; i<rank; i++)
- nelmts*=dims[i];
- if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0)
- goto error;
- if ((msize=H5Tget_size(mtype_id))==0)
- goto error;
-
- if (nelmts)
- {
- buf=(void *) HDmalloc((unsigned)(nelmts*msize));
- if ( buf==NULL){
- printf( "cannot read into memory\n" );
- goto error;
- }
- if (H5Dread(dset_id,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
- goto error;
- }
+ hid_t dset_id=-1; /* dataset ID */
+ hid_t dcpl_id=-1; /* dataset creation property list ID */
+ hid_t space_id=-1; /* space ID */
+ hid_t ftype_id=-1; /* file data type ID */
+ hid_t mtype_id=-1; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ void *buf=NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ int i;
- if (H5Pclose(dcpl_id)<0)
- goto error;
- if (H5Sclose(space_id)<0)
- goto error;
- if (H5Dclose(dset_id)<0)
- goto error;
- if (buf)
- free(buf);
+ if ((dset_id=H5Dopen(fid,name))<0)
+ goto error;
+ if ((space_id=H5Dget_space(dset_id))<0)
+ goto error;
+ if ((ftype_id=H5Dget_type (dset_id))<0)
+ goto error;
+ if ((dcpl_id=H5Dget_create_plist(dset_id))<0)
+ goto error;
+ if ( (rank=H5Sget_simple_extent_ndims(space_id))<0)
+ goto error;
+ HDmemset(dims, 0, sizeof dims);
+ if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0)
+ goto error;
+ nelmts=1;
+ for (i=0; i<rank; i++)
+ nelmts*=dims[i];
+ if ((mtype_id=H5Tget_native_type(ftype_id,H5T_DIR_DEFAULT))<0)
+ goto error;
+ if ((msize=H5Tget_size(mtype_id))==0)
+ goto error;
- return 0;
+ if (nelmts)
+ {
+ buf=(void *) HDmalloc((unsigned)(nelmts*msize));
+ if ( buf==NULL){
+ printf( "cannot read into memory\n" );
+ goto error;
+ }
+ if (H5Dread(dset_id,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ goto error;
+ }
+
+ if (H5Pclose(dcpl_id)<0)
+ goto error;
+ if (H5Sclose(space_id)<0)
+ goto error;
+ if (H5Dclose(dset_id)<0)
+ goto error;
+ if (buf)
+ free(buf);
+
+ return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dcpl_id);
- H5Sclose(space_id);
- H5Dclose(dset_id);
- H5Tclose(ftype_id);
- H5Tclose(mtype_id);
- if (buf)
- free(buf);
- } H5E_END_TRY;
- return -1;
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl_id);
+ H5Sclose(space_id);
+ H5Dclose(dset_id);
+ H5Tclose(ftype_id);
+ H5Tclose(mtype_id);
+ if (buf)
+ free(buf);
+ } H5E_END_TRY;
+ return -1;
}