summaryrefslogtreecommitdiffstats
path: root/src/H5MF.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-06-23 03:41:22 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-06-23 03:41:22 (GMT)
commit4bf629adc96541fda24bafbdde00fd4ff92be344 (patch)
tree8e6d57995ba50bafdf172df9d480bd99cdb1230e /src/H5MF.c
parent62607debf74800472572e65517ed284aef19a63c (diff)
downloadhdf5-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/H5MF.c')
-rw-r--r--src/H5MF.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/H5MF.c b/src/H5MF.c
index 6a51ff7..ddd29ec 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -122,7 +122,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
if (H5F_addr_gt (addr, &(blk.addr))) {
/* Free the first part of the free block */
n = addr->offset - blk.addr.offset;
- H5MF_free (f, &(blk.addr), n);
+ H5MF_xfree (f, &(blk.addr), n);
blk.addr = *addr;
blk.size -= n;
}
@@ -131,7 +131,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
/* Free the second part of the free block */
H5F_addr_inc (&(blk.addr), size);
blk.size -= size;
- H5MF_free (f, &(blk.addr), blk.size);
+ H5MF_xfree (f, &(blk.addr), blk.size);
}
} else {
@@ -168,14 +168,14 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
/* Partial match */
if (H5F_addr_gt (addr, &(blk.addr))) {
n = addr->offset - blk.addr.offset;
- H5MF_free (f, &(blk.addr), n);
+ H5MF_xfree (f, &(blk.addr), n);
blk.addr = *addr;
blk.size -= n;
}
if (blk.size > size) {
H5F_addr_inc (&(blk.addr), size);
blk.size -= size;
- H5MF_free (f, &(blk.addr), blk.size);
+ H5MF_xfree (f, &(blk.addr), blk.size);
}
}
}
@@ -184,7 +184,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
}
/*-------------------------------------------------------------------------
- * Function: H5MF_free
+ * Function: H5MF_xfree
*
* Purpose: Frees part of a file, making that part of the file
* available for reuse.
@@ -204,16 +204,17 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_free(H5F_t *f, const haddr_t *addr, hsize_t size)
+H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
{
int i;
- FUNC_ENTER(H5MF_free, FAIL);
+ FUNC_ENTER(H5MF_xfree, FAIL);
/* check arguments */
assert(f);
- if (!addr || !H5F_addr_defined(addr) || 0 == size)
+ if (!addr || !H5F_addr_defined(addr) || 0 == size) {
HRETURN(SUCCEED);
+ }
assert(!H5F_addr_zerop(addr));
/*
@@ -294,7 +295,7 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
} else if (0==new_size) {
/* Degenerate to H5MF_free() */
assert (H5F_addr_defined (orig_addr));
- if (H5MF_free (f, orig_addr, orig_size)<0) {
+ if (H5MF_xfree (f, orig_addr, orig_size)<0) {
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to free old file memory");
}
@@ -306,7 +307,7 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to allocate new file memory");
}
- if (H5MF_free (f, orig_addr, orig_size)<0) {
+ if (H5MF_xfree (f, orig_addr, orig_size)<0) {
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL,
"unable to free old file memory");
}