summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-07-28 18:25:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-07-28 18:25:43 (GMT)
commite4834c43ce6528308ebd5375bd4c7a0df88af427 (patch)
tree0039040d95cc92fdb197b2902436e32a020a7b6f /src/H5HG.c
parent139688863f191366fe27fbab9654a52285e63c11 (diff)
downloadhdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.zip
hdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.tar.gz
hdf5-e4834c43ce6528308ebd5375bd4c7a0df88af427.tar.bz2
[svn-r1548] Changes since 19990727
---------------------- ./src/H5.c [1.3] ./src/H5AC.c [1.3] ./src/H5ACprivate.h [1.3] ./src/H5B.c [1.3] ./src/H5Bprivate.h [1.3] ./src/H5D.c [1.3] ./src/H5F.c [1.3] ./src/H5Farray.c [1.3] ./src/H5Fcore.c [1.3] ./src/H5Ffamily.c [1.3] ./src/H5Fistore.c [1.3] ./src/H5Flow.c [1.3] ./src/H5Fmpio.c [1.3] ./src/H5Fprivate.h [1.3] ./src/H5Fsec2.c [1.3] ./src/H5Fsplit.c [1.3] ./src/H5Fstdio.c [1.3] ./src/H5G.c [1.3] ./src/H5Gent.c [1.3] ./src/H5Gnode.c [1.3] ./src/H5Gprivate.h [1.3] ./src/H5Gstab.c [1.3] ./src/H5HG.c [1.3] ./src/H5HGprivate.h [1.3] ./src/H5HL.c [1.3] ./src/H5HLprivate.h [1.3] ./src/H5MF.c [1.3] ./src/H5MFprivate.h [1.3] ./src/H5O.c [1.3] ./src/H5Oattr.c [1.3] ./src/H5Ocont.c [1.3] ./src/H5Odtype.c [1.3] ./src/H5Oefl.c [1.3] ./src/H5Olayout.c [1.3] ./src/H5Oprivate.h [1.3] ./src/H5Oshared.c [1.3] ./src/H5Ostab.c [1.3] ./src/H5P.c [1.3] ./src/H5R.c [1.3] ./src/H5Smpio.c [1.3] ./src/H5T.c [1.3] ./src/H5Tvlen.c [1.3] ./src/H5private.h [1.3] ./test/dtypes.c [1.3] ./test/gheap.c [1.3] ./test/istore.c [1.3] ./test/lheap.c [1.3] ./test/ohdr.c [1.3] ./tools/h5debug.c [1.3] File addresses (the `haddr_t' type) are passed by value instead of by reference. The type is no longer a struct. This is one of the preliminary changes needed for the Virtual File Layer stuff. ./src/H5Fprivate.h [1.3] ./src/H5Flow.c [1.3] Some address functions were rewritten as macros.
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);