diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-07-20 21:47:15 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-07-20 21:47:15 (GMT) |
commit | 08bb61054759d30c048af7baf1ca144b93ac9ce0 (patch) | |
tree | 6267483df5703b615d7b657145fa9bbe80ee8ee7 /src/H5HGcache.c | |
parent | 0a5bcc1df0ee1008e7c967facaa8b06797b669e1 (diff) | |
download | hdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.zip hdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.tar.gz hdf5-08bb61054759d30c048af7baf1ca144b93ac9ce0.tar.bz2 |
[svn-r21133] Description:
More code cleanups to reduce coupling between packages that use the H5F
internal routines, but really aren't part of the H5F "package".
Tested on:
FreeBSD/32 8.2 (loyalty) w/gcc4.6, w/C++ & FORTRAN, in debug mode
FreeBSD/64 8.2 (freedom) w/gcc4.6, w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (koala) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Mac OS X/32 10.6.8 (amazon) in debug mode
Diffstat (limited to 'src/H5HGcache.c')
-rw-r--r-- | src/H5HGcache.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/H5HGcache.c b/src/H5HGcache.c index a3cf5b1..c26d2f7 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -28,7 +28,6 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ #define H5HG_PACKAGE /*suppress error about including H5HGpkg */ @@ -37,7 +36,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ +#include "H5Fprivate.h" /* File access */ #include "H5HGpkg.h" /* Global heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ @@ -131,7 +130,7 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) /* Read the initial 4k page */ if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - heap->shared = f->shared; + heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, (size_t)H5HG_MINSIZE))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(H5F_block_read(f, H5FD_MEM_GHEAP, addr, (size_t)H5HG_MINSIZE, dxpl_id, heap->chunk) < 0) @@ -252,30 +251,9 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata) HDassert(max_idx < heap->nused); - /* - * Add the new heap to the CWFS list, removing some other entry if - * necessary to make room. We remove the right-most entry that has less - * free space than this heap. - */ - if(!f->shared->cwfs) { - if(NULL == (f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5HG_NCWFS * sizeof(H5HG_heap_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - f->shared->ncwfs = 1; - f->shared->cwfs[0] = heap; - } else if(H5HG_NCWFS == f->shared->ncwfs) { - int i; /* Local index variable */ - - for(i = H5HG_NCWFS - 1; i >= 0; --i) - if(f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { - HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, i * sizeof(H5HG_heap_t *)); - f->shared->cwfs[0] = heap; - break; - } /* end if */ - } else { - HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *)); - f->shared->ncwfs += 1; - f->shared->cwfs[0] = heap; - } /* end else */ + /* Add the new heap to the CWFS list for the file */ + if(H5F_cwfs_add(f, heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "unable to add global heap collection to file's CWFS") ret_value = heap; |