From 59ac4c5e9dfc32077f351267569c274d6caa6f04 Mon Sep 17 00:00:00 2001 From: James Laird Date: Tue, 21 Nov 2006 11:02:34 -0500 Subject: [svn-r12957] Clean up some purify warnings in the code by making sure that memory is always initialized. Tested on heping, kagiso, and juniper. --- src/H5Fsuper.c | 2 +- src/H5SM.c | 4 ++++ src/H5SMcache.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) 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; xmessages[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; xlist_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; } -- cgit v0.12