From 3f7b3c752d76c8812b20d23c9307fbf44fd3e058 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 17 Apr 2004 11:05:20 -0500 Subject: [svn-r8366] Purpose: Code optimization Description: Eliminate memset() calls to clear structures that we completely initialize Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) too minor to require h5committest --- src/H5Distore.c | 7 +++---- src/H5Fistore.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/H5Distore.c b/src/H5Distore.c index 3efc914..772b763 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -914,7 +914,6 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ - H5F_istore_ud1_t udata; /*pass through B-tree */ unsigned u; /*counters */ void *buf=NULL; /*temporary buffer */ size_t alloc; /*bytes allocated for BUF */ @@ -925,10 +924,11 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, assert(f); assert(ent); assert(!ent->locked); - HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); buf = ent->chunk; if (ent->dirty) { + H5F_istore_ud1_t udata; /*pass through B-tree */ + udata.mesg = *(ent->layout); udata.key.filter_mask = 0; udata.addr = HADDR_UNDEF; @@ -1355,7 +1355,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con H5F_rdcc_t *rdcc = &(f->shared->rdcc);/*raw data chunk cache*/ H5F_rdcc_ent_t *ent = NULL; /*cache entry */ unsigned u; /*counters */ - H5F_istore_ud1_t udata; /*B-tree pass-through */ size_t chunk_size=0; /*size of a chunk */ herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ @@ -1364,7 +1363,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con FUNC_ENTER_NOAPI_NOINIT(H5F_istore_lock); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); if (rdcc->nslots>0) { for (u=0, temp_idx=0; undims; u++) { @@ -1410,6 +1408,7 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); } else { + H5F_istore_ud1_t udata; /*B-tree pass-through */ /* * Not in the cache. Read it from the file and count this as a miss diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 3efc914..772b763 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -914,7 +914,6 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, H5F_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ - H5F_istore_ud1_t udata; /*pass through B-tree */ unsigned u; /*counters */ void *buf=NULL; /*temporary buffer */ size_t alloc; /*bytes allocated for BUF */ @@ -925,10 +924,11 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, assert(f); assert(ent); assert(!ent->locked); - HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); buf = ent->chunk; if (ent->dirty) { + H5F_istore_ud1_t udata; /*pass through B-tree */ + udata.mesg = *(ent->layout); udata.key.filter_mask = 0; udata.addr = HADDR_UNDEF; @@ -1355,7 +1355,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con H5F_rdcc_t *rdcc = &(f->shared->rdcc);/*raw data chunk cache*/ H5F_rdcc_ent_t *ent = NULL; /*cache entry */ unsigned u; /*counters */ - H5F_istore_ud1_t udata; /*B-tree pass-through */ size_t chunk_size=0; /*size of a chunk */ herr_t status; /*func return status */ void *chunk=NULL; /*the file chunk */ @@ -1364,7 +1363,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con FUNC_ENTER_NOAPI_NOINIT(H5F_istore_lock); assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); - HDmemset(&udata, 0, sizeof(H5F_istore_ud1_t)); if (rdcc->nslots>0) { for (u=0, temp_idx=0; undims; u++) { @@ -1410,6 +1408,7 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); } else { + H5F_istore_ud1_t udata; /*B-tree pass-through */ /* * Not in the cache. Read it from the file and count this as a miss -- cgit v0.12