summaryrefslogtreecommitdiffstats
path: root/src/H5H.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-10-22 22:08:14 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-10-22 22:08:14 (GMT)
commite1e488bd4758a0e5b85a8e04052146a93c3e5751 (patch)
tree78181af3453d7cac4e4fb971c85a35472b5e389a /src/H5H.c
parent4fe5ac09995cf3c0a93d942b205c091d266fe258 (diff)
downloadhdf5-e1e488bd4758a0e5b85a8e04052146a93c3e5751.zip
hdf5-e1e488bd4758a0e5b85a8e04052146a93c3e5751.tar.gz
hdf5-e1e488bd4758a0e5b85a8e04052146a93c3e5751.tar.bz2
[svn-r133] ./MANIFEST
./src/Makefile.in Added new files. ./html/H5.apiv2.html Added documentation for group stuff. ./src/H5private.h ./src/H5E.c ./src/H5Epublic.h ./src/H5F.c ./src/H5Flow.c NEW ./src/H5Fprivate.h ./src/H5Fsec2.c NEW ./src/H5Fstdio.c NEW Low-level file driver is selected at runtime. ./src/H5Fprivate.h Got rid of `shift >= sizeof operand' warnings on big endian machines. ./src/H5Fistore.c ./test/istore.c Still working on indexed storage... ./src/H5H.c ./src/H5Hprivate.h Removed alignment constraints.
Diffstat (limited to 'src/H5H.c')
-rw-r--r--src/H5H.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/H5H.c b/src/H5H.c
index 64809e4..4c44613 100644
--- a/src/H5H.c
+++ b/src/H5H.c
@@ -519,7 +519,7 @@ H5H_insert (H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
H5H_t *heap=NULL;
H5H_free_t *fl=NULL, *max_fl=NULL;
off_t offset = -1;
- size_t need, old_size, need_more;
+ size_t old_size, need_more;
#ifndef NDEBUG
static nmessages = 0;
#endif
@@ -533,10 +533,6 @@ H5H_insert (H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
assert (buf_size>0);
assert (buf);
- /* allocate aligned file memory */
- need = buf_size;
- H5H_ALIGN (need);
-
if (NULL==(heap=H5AC_find (f, H5AC_HEAP, addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL);
}
@@ -547,12 +543,12 @@ H5H_insert (H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl=heap->freelist; fl; fl=fl->next) {
- if (fl->size>need && fl->size-need>=H5H_SIZEOF_FREE(f)) {
+ if (fl->size>buf_size && fl->size-buf_size>=H5H_SIZEOF_FREE(f)) {
offset = fl->offset;
- fl->offset += need;
- fl->size -= need;
+ fl->offset += buf_size;
+ fl->size -= buf_size;
break;
- } else if (fl->size==need) {
+ } else if (fl->size==buf_size) {
offset = fl->offset;
fl = H5H_remove_free (heap, fl);
break;
@@ -570,15 +566,15 @@ H5H_insert (H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
*/
if (offset<0) {
- need_more = MAX3 (need, heap->mem_alloc, H5H_SIZEOF_FREE(f));
+ need_more = MAX3 (buf_size, heap->mem_alloc, H5H_SIZEOF_FREE(f));
if (max_fl && max_fl->offset+max_fl->size==heap->mem_alloc) {
/*
* Increase the size of the maximum free block.
*/
offset = max_fl->offset;
- max_fl->offset += need;
- max_fl->size += need_more - need;
+ max_fl->offset += buf_size;
+ max_fl->size += need_more - buf_size;
if (max_fl->size < H5H_SIZEOF_FREE(f)) {
#ifndef NDEBUG
@@ -600,18 +596,18 @@ H5H_insert (H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
* take some space out of it right away.
*/
offset = heap->mem_alloc;
- if (need_more-need >= H5H_SIZEOF_FREE(f)) {
+ if (need_more-buf_size >= H5H_SIZEOF_FREE(f)) {
fl = H5MM_xmalloc (sizeof(H5H_free_t));
- fl->offset = heap->mem_alloc + need;
- fl->size = need_more - need;
+ fl->offset = heap->mem_alloc + buf_size;
+ fl->size = need_more - buf_size;
fl->prev = NULL;
fl->next = heap->freelist;
if (heap->freelist) heap->freelist->prev = fl;
heap->freelist = fl;
#ifndef NDEBUG
- } else if (need_more>need) {
+ } else if (need_more>buf_size) {
fprintf (stderr, "H5H_insert: lost %d bytes at line %d\n",
- need_more-need, __LINE__);
+ need_more-buf_size, __LINE__);
if (0==nmessages++) {
fprintf (stderr, "Messages from H5H_insert() will go away "
"when assertions are turned off.\n");