diff options
Diffstat (limited to 'src/H5HG.c')
-rw-r--r-- | src/H5HG.c | 38 |
1 files changed, 18 insertions, 20 deletions
@@ -456,26 +456,24 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, * necessary to make room. We remove the right-most entry that has less * free space than this heap. */ - if (heap->obj[0].size>0) { - if (!f->shared->cwfs) { - f->shared->cwfs = H5MM_malloc (H5HG_NCWFS*sizeof(H5HG_heap_t*)); - if (NULL==f->shared->cwfs) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - f->shared->ncwfs = 1; - f->shared->cwfs[0] = heap; - } else if (H5HG_NCWFS==f->shared->ncwfs) { - for (i=H5HG_NCWFS-1; i>=0; --i) { - if (f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, i * sizeof(H5HG_heap_t*)); - f->shared->cwfs[0] = heap; - break; - } - } - } else { - HDmemmove (f->shared->cwfs+1, f->shared->cwfs, f->shared->ncwfs*sizeof(H5HG_heap_t*)); - f->shared->ncwfs += 1; - f->shared->cwfs[0] = heap; - } + if (!f->shared->cwfs) { + f->shared->cwfs = H5MM_malloc (H5HG_NCWFS*sizeof(H5HG_heap_t*)); + if (NULL==f->shared->cwfs) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + f->shared->ncwfs = 1; + f->shared->cwfs[0] = heap; + } else if (H5HG_NCWFS==f->shared->ncwfs) { + for (i=H5HG_NCWFS-1; i>=0; --i) { + if (f->shared->cwfs[i]->obj[0].size < heap->obj[0].size) { + HDmemmove (f->shared->cwfs+1, f->shared->cwfs, i * sizeof(H5HG_heap_t*)); + f->shared->cwfs[0] = heap; + break; + } + } + } else { + HDmemmove (f->shared->cwfs+1, f->shared->cwfs, f->shared->ncwfs*sizeof(H5HG_heap_t*)); + f->shared->ncwfs += 1; + f->shared->cwfs[0] = heap; } ret_value = heap; |