summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5HG.c')
-rw-r--r--src/H5HG.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index afd6230..bfafd46 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -49,9 +49,9 @@ struct H5HG_heap_t {
};
/* PRIVATE PROTOTYPES */
-static H5HG_heap_t *H5HG_load(H5F_t *f, const haddr_t *addr,
- const void *udata1, void *udata2);
-static herr_t H5HG_flush(H5F_t *f, hbool_t dest, const haddr_t *addr,
+static H5HG_heap_t *H5HG_load(H5F_t *f, haddr_t addr, const void *udata1,
+ void *udata2);
+static herr_t H5HG_flush(H5F_t *f, hbool_t dest, haddr_t addr,
H5HG_heap_t *heap);
/*
@@ -59,8 +59,8 @@ static herr_t H5HG_flush(H5F_t *f, hbool_t dest, const haddr_t *addr,
*/
static const H5AC_class_t H5AC_GHEAP[1] = {{
H5AC_GHEAP_ID,
- (void *(*)(H5F_t*, const haddr_t*, const void*, void*))H5HG_load,
- (herr_t (*)(H5F_t*, hbool_t, const haddr_t*, void*))H5HG_flush,
+ (void *(*)(H5F_t*, haddr_t, const void*, void*))H5HG_load,
+ (herr_t (*)(H5F_t*, hbool_t, haddr_t, void*))H5HG_flush,
}};
/* Interface initialization */
@@ -156,7 +156,7 @@ H5HG_create (H5F_t *f, size_t size)
HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p));
/* Add the heap to the cache */
- if (H5AC_set (f, H5AC_GHEAP, &addr, heap)<0) {
+ if (H5AC_set (f, H5AC_GHEAP, addr, heap)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, NULL,
"unable to cache global heap collection");
}
@@ -202,11 +202,12 @@ H5HG_create (H5F_t *f, size_t size)
* Friday, March 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static H5HG_heap_t *
-H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
+H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
void UNUSED *udata2)
{
H5HG_heap_t *heap = NULL;
@@ -219,7 +220,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
/* check arguments */
assert (f);
- assert (addr && H5F_addr_defined (addr));
+ assert (H5F_addr_defined (addr));
assert (!udata1);
assert (!udata2);
@@ -228,7 +229,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- heap->addr = *addr;
+ heap->addr = addr;
if (NULL==(heap->chunk = H5MM_malloc (H5HG_MINSIZE))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
@@ -264,13 +265,13 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
* collection now.
*/
if (heap->size > H5HG_MINSIZE) {
- haddr_t next_addr = *addr;
+ haddr_t next_addr = addr;
H5F_addr_inc (&next_addr, (hsize_t)H5HG_MINSIZE);
if (NULL==(heap->chunk = H5MM_realloc (heap->chunk, heap->size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
- if (H5F_block_read (f, &next_addr, (hsize_t)(heap->size-H5HG_MINSIZE),
+ if (H5F_block_read (f, next_addr, (hsize_t)(heap->size-H5HG_MINSIZE),
&H5F_xfer_dflt, heap->chunk+H5HG_MINSIZE)<0) {
HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL,
"unable to read global heap collection");
@@ -377,11 +378,12 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void UNUSED *udata1,
* Friday, March 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
static herr_t
-H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap)
+H5HG_flush (H5F_t *f, hbool_t destroy, haddr_t addr, H5HG_heap_t *heap)
{
int i;
@@ -389,8 +391,8 @@ H5HG_flush (H5F_t *f, hbool_t destroy, const haddr_t *addr, H5HG_heap_t *heap)
/* Check arguments */
assert (f);
- assert (addr && H5F_addr_defined (addr));
- assert (H5F_addr_eq (addr, &(heap->addr)));
+ assert (H5F_addr_defined (addr));
+ assert (H5F_addr_eq (addr, heap->addr));
assert (heap);
if (heap->dirty) {
@@ -643,7 +645,7 @@ H5HG_peek (H5F_t *f, H5HG_t *hobj)
assert (hobj);
/* Load the heap and return a pointer to the object */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -704,7 +706,7 @@ H5HG_read (H5F_t *f, H5HG_t *hobj, void *object/*out*/)
assert (hobj);
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -773,7 +775,7 @@ H5HG_link (H5F_t *f, H5HG_t *hobj, intn adjust)
}
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -826,7 +828,7 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
}
/* Load the heap */
- if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, &(hobj->addr), NULL, NULL))) {
+ if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
@@ -868,8 +870,8 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
* to the file free list.
*/
heap->dirty = FALSE;
- H5MF_xfree (f, &(heap->addr), (hsize_t)(heap->size));
- H5AC_flush (f, H5AC_GHEAP, &(heap->addr), TRUE);
+ H5MF_xfree (f, heap->addr, (hsize_t)(heap->size));
+ H5AC_flush (f, H5AC_GHEAP, heap->addr, TRUE);
heap = NULL;
} else {
/*
@@ -908,11 +910,12 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
* Mar 27, 1998
*
* Modifications:
- *
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*-------------------------------------------------------------------------
*/
herr_t
-H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
+H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, intn indent,
intn fwidth)
{
int i, nused, maxobj;
@@ -926,7 +929,7 @@ H5HG_debug(H5F_t *f, const haddr_t *addr, FILE *stream, intn indent,
/* check arguments */
assert(f);
- assert(addr && H5F_addr_defined (addr));
+ assert(H5F_addr_defined (addr));
assert(stream);
assert(indent >= 0);
assert(fwidth >= 0);