diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-06-23 03:41:22 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-06-23 03:41:22 (GMT) |
commit | 4bf629adc96541fda24bafbdde00fd4ff92be344 (patch) | |
tree | 8e6d57995ba50bafdf172df9d480bd99cdb1230e /src/H5D.c | |
parent | 62607debf74800472572e65517ed284aef19a63c (diff) | |
download | hdf5-4bf629adc96541fda24bafbdde00fd4ff92be344.zip hdf5-4bf629adc96541fda24bafbdde00fd4ff92be344.tar.gz hdf5-4bf629adc96541fda24bafbdde00fd4ff92be344.tar.bz2 |
[svn-r435] ./INSTALL
./INSTALL_MAINT
./README
./RELEASE
Partially updated for second alpha, but haven't updated
version numbers yet.
./src/H5.c
./src/H5A.c
./src/H5AC.c
./src/H5B.c
./src/H5D.c
./src/H5F.c
./src/H5Fcore.c
./src/H5Ffamily.c
./src/H5Fistore.c
./src/H5Fmpio.c
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5G.c
./src/H5Gnode.c
./src/H5HG.c
./src/H5HL.c
./src/H5I.c
./src/H5MM.c
./src/H5MMprivate.h
./src/H5O.c
./src/H5Oattr.c
./src/H5Ocomp.c
./src/H5Ocont.c
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Olayout.c
./src/H5Oname.c
./src/H5Osdspace.c
./src/H5Oshared.c
./src/H5Ostab.c
./src/H5P.c
./src/H5S.c
./src/H5T.c
./src/H5Tconv.c
./src/H5detect.c
./test/hyperslab.c
./test/istore.c
Changed memory allocation functions so they fail instead of
dumping core. The `x' was removed from the name to remind us
of that: H5MM_xmalloc() -> H5MM_malloc(), etc.
H5MM_calloc() takes one argument like H5MM_malloc() instead of
two like calloc() because we almost always called it with `1'
for one of the arguments anyway. The only difference between
the two functions is that H5MM_calloc() returns memory which
is initialized to zero.
./src/H5Gent.c
./src/H5Gprivate.h
Removed H5G_ent_calloc() since it wasn't used.
./src/H5Fistore.c
Fixed a bug found by Albert. Thanks, Albert! This fix
combined with the changes to memory allocation prevent the
library from failing an assertion if the application uses an
unreasonable size for chunks (like Alberts 10000x10000x4).
./src/H5MF.c
./src/H5MFprivate.h
Changed H5MF_free() to H5MF_xfree() since calling it with an
undefined address is allowed.
Diffstat (limited to 'src/H5D.c')
-rw-r--r-- | src/H5D.c | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -783,7 +783,10 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space, } /* Initialize the dataset object */ - new_dset = H5MM_xcalloc(1, sizeof(H5D_t)); + if (NULL==(new_dset = H5MM_calloc(sizeof(H5D_t)))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed"); + } H5F_addr_undef(&(new_dset->ent.header)); new_dset->type = H5T_copy(type, H5T_COPY_ALL); new_dset->create_parms = H5P_copy (H5P_DATASET_CREATE, create_parms); @@ -978,7 +981,10 @@ H5D_open(H5G_t *loc, const char *name) assert (name && *name); f = H5G_fileof (loc); - dataset = H5MM_xcalloc(1, sizeof(H5D_t)); + if (NULL==(dataset = H5MM_calloc(sizeof(H5D_t)))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed"); + } dataset->create_parms = H5P_copy (H5P_DATASET_CREATE, &H5D_create_dflt); H5F_addr_undef(&(dataset->ent.header)); @@ -1316,10 +1322,16 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } if (NULL==(tconv_buf=xfer_parms->tconv_buf)) { - tconv_buf = H5MM_xmalloc (target_size); + if (NULL==(tconv_buf = H5MM_malloc (target_size))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion"); + } } if (need_bkg && NULL==(bkg_buf=xfer_parms->bkg_buf)) { - bkg_buf = H5MM_xmalloc (smine_nelmts * dst_type_size); + if (NULL==(bkg_buf = H5MM_malloc (smine_nelmts * dst_type_size))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for background buffer"); + } } #ifdef H5D_DEBUG @@ -1604,10 +1616,16 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } if (NULL==(tconv_buf=xfer_parms->tconv_buf)) { - tconv_buf = H5MM_xmalloc (target_size); + if (NULL==(tconv_buf = H5MM_malloc (target_size))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion"); + } } if (need_bkg && NULL==(bkg_buf=xfer_parms->bkg_buf)) { - bkg_buf = H5MM_xmalloc (smine_nelmts * dst_type_size); + if (NULL==(bkg_buf = H5MM_malloc (smine_nelmts * dst_type_size))) { + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for background buffer"); + } } #ifdef H5D_DEBUG |