diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-22 19:53:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-22 19:53:17 (GMT) |
commit | 1cee912aaa058fa765be45c82881a458d32bc7b3 (patch) | |
tree | f7726c1276989d0f957fe88360464f2c39c56d38 /src/H5Ostab.c | |
parent | 293fe87eeec295c4bb4227e17557361ef2f22df2 (diff) | |
download | hdf5-1cee912aaa058fa765be45c82881a458d32bc7b3.zip hdf5-1cee912aaa058fa765be45c82881a458d32bc7b3.tar.gz hdf5-1cee912aaa058fa765be45c82881a458d32bc7b3.tar.bz2 |
[svn-r9559] Purpose:
Code optimization
Description:
Switch a few more malloc/free pairs over to using internal free list code,
to avoid abusing system memory allocator as badly.
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Solaris 2.7 (arabica)
Too minor to require h5committest
Diffstat (limited to 'src/H5Ostab.c')
-rw-r--r-- | src/H5Ostab.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 4b061df..0fbda05 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -176,8 +176,7 @@ H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg) void * H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, void *_mesg) { - H5O_stab_t *stab = NULL; - void *ret_value; /* Return value */ + H5O_stab_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_stab_fast); @@ -187,16 +186,15 @@ H5O_stab_fast(const H5G_cache_t *cache, const H5O_class_t *type, void *_mesg) if (H5O_STAB == type) { if (_mesg) { - stab = (H5O_stab_t *) _mesg; - } else if (NULL==(stab = H5FL_CALLOC(H5O_stab_t))) { + ret_value = (H5O_stab_t *) _mesg; + } else if (NULL==(ret_value = H5FL_MALLOC(H5O_stab_t))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } - stab->btree_addr = cache->stab.btree_addr; - stab->heap_addr = cache->stab.heap_addr; + ret_value->btree_addr = cache->stab.btree_addr; + ret_value->heap_addr = cache->stab.heap_addr; } - - /* Set return value */ - ret_value=stab; + else + ret_value=NULL; done: FUNC_LEAVE_NOAPI(ret_value); |