summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-11-21 16:02:34 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-11-21 16:02:34 (GMT)
commit59ac4c5e9dfc32077f351267569c274d6caa6f04 (patch)
treef9492b5965eae3cb3aa7b33ae36192c7042a0000 /src
parent4d08b756b2eab945921ddef689b7564d07e6a37f (diff)
downloadhdf5-59ac4c5e9dfc32077f351267569c274d6caa6f04.zip
hdf5-59ac4c5e9dfc32077f351267569c274d6caa6f04.tar.gz
hdf5-59ac4c5e9dfc32077f351267569c274d6caa6f04.tar.bz2
[svn-r12957] Clean up some purify warnings in the code by making sure that
memory is always initialized. Tested on heping, kagiso, and juniper.
Diffstat (limited to 'src')
-rw-r--r--src/H5Fsuper.c2
-rwxr-xr-xsrc/H5SM.c4
-rw-r--r--src/H5SMcache.c4
3 files changed, 9 insertions, 1 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index a77030c..61ecacd 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -372,7 +372,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
* fcpl */
if(shared->sohm_addr != HADDR_UNDEF)
{
- unsigned index_flags[H5SM_MAX_NUM_INDEXES];
+ unsigned index_flags[H5SM_MAX_NUM_INDEXES] = {0};
size_t sohm_l2b; /* SOHM list-to-btree cutoff */
size_t sohm_b2l; /* SOHM btree-to-list cutoff */
diff --git a/src/H5SM.c b/src/H5SM.c
index 6c0e3b5..476bcb9 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -426,6 +426,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t * header, hid_t dxpl_id)
/* JAMES: would making fewer operations out of this make it faster? */
for(x=0; x<num_entries; x++)
{
+ list->messages[x].ref_count=0;
list->messages[x].fheap_id=0;
list->messages[x].hash=H5O_HASH_UNDEF;
}
@@ -615,6 +616,9 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
if(NULL == (encoding_buf = H5MM_calloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding");
+ /* JAMES: make purify happy. I think calloc above should do this. */
+ HDmemset(encoding_buf, 0, buf_size);
+
if(H5O_encode(f, encoding_buf, mesg, type_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "can't encode message to be shared");
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 57c181b..85b46d5 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -388,6 +388,9 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
size_t size; /* Header size on disk */
hsize_t x;
+ /* JAMES: consider only writing as many messages as necessary, and then adding a
+ * blank "end of list" message or something?
+ */
size = H5SM_LIST_SIZE(f, list->header->num_messages);
/* Encode the list */
@@ -502,6 +505,7 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
for(x=header->num_messages; x<header->list_to_btree; x++)
{
list->messages[x].fheap_id = 0; /* JAMES: would making this one operation make it faster? */
+ list->messages[x].ref_count = 0;
list->messages[x].hash = H5O_HASH_UNDEF;
}