From 2c865deb88b86d0b5dbd1ec6168c46b0e0d23dd8 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 15 Dec 2010 14:12:53 +0000 Subject: [PATCH] refactor memory allocation function as public core functions --- src/h5core/h5_hdf5.c | 2 +- src/h5core/h5_hsearch.c | 4 +-- src/h5core/h5_lustre.c | 2 +- src/h5core/h5_maps.c | 10 ++++---- src/h5core/h5_openclose.c | 4 +-- src/h5core/h5_syscall.c | 6 ++--- src/h5core/h5_syscall_private.h | 6 ++--- src/h5core/h5b_model.c | 8 +++--- src/h5core/h5t_adjacencies_tetm.c | 4 +-- src/h5core/h5t_adjacencies_trim.c | 4 +-- src/h5core/h5t_hsearch.c | 8 +++--- src/h5core/h5t_openclose.c | 20 +++++++-------- src/h5core/h5t_readwrite.c | 6 ++--- src/h5core/h5t_retrieve.c | 8 +++--- src/h5core/h5t_store.c | 6 ++--- src/h5core/h5t_store_tetm.c | 4 +-- src/h5core/h5t_store_trim.c | 4 +-- src/h5core/h5t_tags.c | 42 +++++++++++++++---------------- 18 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/h5core/h5_hdf5.c b/src/h5core/h5_hdf5.c index d7904e7..ec62a93 100644 --- a/src/h5core/h5_hdf5.c +++ b/src/h5core/h5_hdf5.c @@ -1247,7 +1247,7 @@ _iter_op_get_obj_type ( if ( info->type == H5L_TYPE_EXTERNAL ) { char *buf; - TRY( buf = h5priv_alloc(f, NULL, info->u.val_size) ); + TRY( buf = h5_alloc(f, NULL, info->u.val_size) ); herr = H5Lget_val(g_id, name, buf, info->u.val_size, H5P_DEFAULT); diff --git a/src/h5core/h5_hsearch.c b/src/h5core/h5_hsearch.c index c0cf4f1..04070b4 100644 --- a/src/h5core/h5_hsearch.c +++ b/src/h5core/h5_hsearch.c @@ -82,7 +82,7 @@ h5priv_hcreate ( htab->compute_hash = compute_hash; /* allocate memory and zero out */ - TRY( (htab->table = (_ENTRY *) h5priv_calloc ( + TRY( (htab->table = (_ENTRY *) h5_calloc ( f, htab->size + 1, sizeof (_ENTRY))) ); /* everything went alright */ @@ -142,7 +142,7 @@ h5priv_hdestroy ( } /* Free used memory. */ - TRY( h5priv_free (f, htab->table) ); + TRY( h5_free (f, htab->table) ); /* the sign for an existing table is an value != NULL in htable */ htab->table = NULL; diff --git a/src/h5core/h5_lustre.c b/src/h5core/h5_lustre.c index 683e582..917ae94 100644 --- a/src/h5core/h5_lustre.c +++ b/src/h5core/h5_lustre.c @@ -33,7 +33,7 @@ _get_lustre_stripe_size(h5_file_t *const f, const char *path ) size_t nbytes = sizeof(struct lov_user_md) + INIT_ALLOC_NUM_OSTS * sizeof(struct lov_user_ost_data); struct lov_user_md *lum; - TRY( lum = h5priv_alloc(f, NULL, nbytes) ); + TRY( lum = h5_alloc(f, NULL, nbytes) ); lum->lmm_magic = LOV_USER_MAGIC; int fd = open64(path, O_RDONLY); diff --git a/src/h5core/h5_maps.c b/src/h5core/h5_maps.c index df4847a..bbf211c 100644 --- a/src/h5core/h5_maps.c +++ b/src/h5core/h5_maps.c @@ -12,7 +12,7 @@ h5priv_alloc_idlist_items ( ) { int new = (list->items == NULL); size_t size_in_bytes = size * sizeof (list->items[0]); - TRY( list->items = h5priv_alloc (f, list->items, size_in_bytes) ); + TRY( list->items = h5_alloc (f, list->items, size_in_bytes) ); list->size = size; if (new) list->num_items = 0; return H5_SUCCESS; @@ -37,10 +37,10 @@ h5priv_alloc_idlist ( h5_idlist_t** list, const h5_size_t size ) { - TRY( (*list = h5priv_alloc (f, NULL, sizeof (**list))) ); + TRY( (*list = h5_alloc (f, NULL, sizeof (**list))) ); memset (*list, 0, sizeof (**list)); size_t size_in_bytes = size * sizeof ((*list)->items[0]); - TRY( (*list)->items = h5priv_alloc (f, (*list)->items, size_in_bytes) ); + TRY( (*list)->items = h5_alloc (f, (*list)->items, size_in_bytes) ); (*list)->size = size; return H5_SUCCESS; } @@ -52,7 +52,7 @@ h5priv_free_idlist ( ) { if (*list == NULL) return H5_SUCCESS; TRY( h5priv_free_idlist_items (f, *list) ); - TRY( h5priv_free( f, *list) ); + TRY( h5_free( f, *list) ); *list = NULL; return H5_SUCCESS; } @@ -196,7 +196,7 @@ h5priv_alloc_idxmap ( ) { int new = (map->items == NULL); size_t size_in_bytes = size * sizeof (map->items[0]); - TRY( map->items = h5priv_alloc (f, map->items, size_in_bytes) ); + TRY( map->items = h5_alloc (f, map->items, size_in_bytes) ); map->size = size; if (new) map->num_items = 0; return H5_SUCCESS; diff --git a/src/h5core/h5_openclose.c b/src/h5core/h5_openclose.c index 1b2da3c..8bb5488 100644 --- a/src/h5core/h5_openclose.c +++ b/src/h5core/h5_openclose.c @@ -67,7 +67,7 @@ static h5_err_t h5upriv_open_file ( h5_file_t* const f /*!< IN: file handle */ ) { - TRY( f->u = (h5u_fdata_t*)h5priv_alloc (f, NULL, sizeof (*f->u)) ); + TRY( f->u = (h5u_fdata_t*)h5_alloc (f, NULL, sizeof (*f->u)) ); h5u_fdata_t *u = f->u; u->shape = -1; @@ -101,7 +101,7 @@ h5bpriv_open_file ( if ( f->b ) return H5_SUCCESS; - TRY( f->b = (h5b_fdata_t*)h5priv_alloc( f, NULL, sizeof (*f->b)) ); + TRY( f->b = (h5b_fdata_t*)h5_alloc( f, NULL, sizeof (*f->b)) ); b = f->b; memset (b, 0, sizeof (*b)); diff --git a/src/h5core/h5_syscall.c b/src/h5core/h5_syscall.c index 3a3a299..fa84e76 100644 --- a/src/h5core/h5_syscall.c +++ b/src/h5core/h5_syscall.c @@ -6,7 +6,7 @@ #include "h5_core_private.h" void* -h5priv_alloc ( +h5_alloc ( h5_file_t* const f, void* ptr, const size_t size @@ -22,7 +22,7 @@ h5priv_alloc ( } void* -h5priv_calloc ( +h5_calloc ( h5_file_t* const f, const size_t count, const size_t size @@ -51,7 +51,7 @@ h5priv_strdup ( } h5_err_t -h5priv_free ( +h5_free ( h5_file_t* const f, void* ptr ) { diff --git a/src/h5core/h5_syscall_private.h b/src/h5core/h5_syscall_private.h index e78e55d..686988f 100644 --- a/src/h5core/h5_syscall_private.h +++ b/src/h5core/h5_syscall_private.h @@ -2,21 +2,21 @@ #define __H5_SYSCALL_H void* -h5priv_alloc ( +h5_alloc ( h5_file_t* const f, void* ptr, const size_t size ); void* -h5priv_calloc ( +h5_calloc ( h5_file_t* const f, const size_t count, const size_t size ); h5_err_t -h5priv_free ( +h5_free ( h5_file_t* const f, void* ptr ); diff --git a/src/h5core/h5b_model.c b/src/h5core/h5b_model.c index 6ff7b3c..93af6ba 100644 --- a/src/h5core/h5b_model.c +++ b/src/h5core/h5b_model.c @@ -336,7 +336,7 @@ _dissolve_ghostzones ( memcpy( write_layout, user_layout, f->nprocs*sizeof(h5b_partition_t) ); - TRY( p_begin = (struct list*)h5priv_alloc(f, NULL, sizeof(*p_begin)) ); + TRY( p_begin = (struct list*)h5_alloc(f, NULL, sizeof(*p_begin)) ); p_max = p_end = p_begin; memset( p_begin, 0, sizeof ( *p_begin ) ); @@ -349,7 +349,7 @@ _dissolve_ghostzones ( proc_q++, q++ ) { if ( have_ghostzone ( p, q ) ) { - TRY( p_el = (struct list*)h5priv_alloc(f, NULL, sizeof(*p_el)) ); + TRY( p_el = (struct list*)h5_alloc(f, NULL, sizeof(*p_el)) ); p_el->p = p; p_el->q = q; @@ -549,8 +549,8 @@ h5b_3d_set_view ( h5b_partition_t *write_layout; size_t size = f->nprocs * sizeof (h5b_partition_t); - TRY( user_layout = h5priv_alloc (f, NULL, size) ); - TRY( write_layout = h5priv_alloc (f, NULL, size) ); + TRY( user_layout = h5_alloc (f, NULL, size) ); + TRY( write_layout = h5_alloc (f, NULL, size) ); TRY( h5priv_mpi_allgather(f, p, 1, f->b->partition_mpi_t, diff --git a/src/h5core/h5t_adjacencies_tetm.c b/src/h5core/h5t_adjacencies_tetm.c index c208723..ddf9482 100644 --- a/src/h5core/h5t_adjacencies_tetm.c +++ b/src/h5core/h5t_adjacencies_tetm.c @@ -27,7 +27,7 @@ alloc_tv ( h5t_adjacencies_t* adj = &t->adjacencies; // allocate one ID list per vertex - TRY( adj->tv.v = h5priv_calloc (f, num_vertices, sizeof(*adj->tv.v)) ); + TRY( adj->tv.v = h5_calloc (f, num_vertices, sizeof(*adj->tv.v)) ); return H5_SUCCESS; } @@ -45,7 +45,7 @@ release_tv ( for (; idx < last; idx++) { TRY( h5priv_free_idlist_items (f, &adj->tv.v[idx]) ); } - TRY( h5priv_free (f, adj->tv.v) ); + TRY( h5_free (f, adj->tv.v) ); adj->tv.v = NULL; return H5_SUCCESS; } diff --git a/src/h5core/h5t_adjacencies_trim.c b/src/h5core/h5t_adjacencies_trim.c index 8b53dd5..4d52ac0 100644 --- a/src/h5core/h5t_adjacencies_trim.c +++ b/src/h5core/h5t_adjacencies_trim.c @@ -26,7 +26,7 @@ alloc_tv ( h5t_adjacencies_t* adj = &t->adjacencies; // allocate one ID list per vertex - TRY( adj->tv.v = h5priv_calloc (f, num_vertices, sizeof(*adj->tv.v)) ); + TRY( adj->tv.v = h5_calloc (f, num_vertices, sizeof(*adj->tv.v)) ); return H5_SUCCESS; } @@ -44,7 +44,7 @@ release_tv ( for (; idx < last; idx++) { TRY( h5priv_free_idlist_items (f, &adj->tv.v[idx]) ); } - TRY( h5priv_free (f, adj->tv.v) ); + TRY( h5_free (f, adj->tv.v) ); adj->tv.v = NULL; return H5_SUCCESS; } diff --git a/src/h5core/h5t_hsearch.c b/src/h5core/h5t_hsearch.c index e395052..9ed04b1 100644 --- a/src/h5core/h5t_hsearch.c +++ b/src/h5core/h5t_hsearch.c @@ -70,7 +70,7 @@ h5tpriv_search_te2 ( void* __retval; h5t_te_entry_t* entry; - TRY( entry = h5priv_calloc (f, 1, sizeof (*entry)) ); + TRY( entry = h5_calloc (f, 1, sizeof (*entry)) ); TRY( h5t_get_vertex_indices_of_edge2 ( f, face_idx, elem_idx, entry->key.vids) ); @@ -109,7 +109,7 @@ h5tpriv_search_te2 ( h5tpriv_build_edge_id (face_idx, elem_idx)) ); if (entry->value.num_items > 1) { /* search returned an existing entry */ - TRY( h5priv_free (f, entry) ); + TRY( h5_free (f, entry) ); } *retval = &te_entry->value; return H5_SUCCESS; @@ -230,7 +230,7 @@ h5tpriv_search_td2 ( void* __retval; h5t_td_entry_t* entry; - TRY( entry = h5priv_calloc (f, 1, sizeof(*entry)) ); + TRY( entry = h5_calloc (f, 1, sizeof(*entry)) ); TRY( h5t_get_vertex_indices_of_triangle2 ( f, face_idx, elem_idx, entry->key.vids) ); @@ -259,7 +259,7 @@ h5tpriv_search_td2 ( &td_entry->value, h5tpriv_build_triangle_id (face_idx, elem_idx)) ); if (td_entry->value.num_items > 1) { - TRY( h5priv_free (f, entry) ); + TRY( h5_free (f, entry) ); } *retval = &td_entry->value; diff --git a/src/h5core/h5t_openclose.c b/src/h5core/h5t_openclose.c index 2c36b91..2c97af5 100644 --- a/src/h5core/h5t_openclose.c +++ b/src/h5core/h5t_openclose.c @@ -344,7 +344,7 @@ h5tpriv_open_file ( h5_file_t* const f /*!< IN: file handle */ ) { - TRY( (f->t = h5priv_calloc (f, 1, sizeof (*f->t))) ); + TRY( (f->t = h5_calloc (f, 1, sizeof (*f->t))) ); h5t_fdata_t* t = f->t; t->dtypes.h5_glb_idx_t = H5_INT64_T; @@ -496,11 +496,11 @@ release_elems ( h5_file_t* const f ) { h5t_fdata_t* t = f->t; - TRY( h5priv_free (f, t->glb_elems.data) ); - TRY( h5priv_free (f, t->loc_elems.data) ); - TRY( h5priv_free (f, t->num_elems) ); - TRY( h5priv_free (f, t->num_elems_on_level) ); - TRY( h5priv_free (f, t->map_elem_g2l.items) ); + TRY( h5_free (f, t->glb_elems.data) ); + TRY( h5_free (f, t->loc_elems.data) ); + TRY( h5_free (f, t->num_elems) ); + TRY( h5_free (f, t->num_elems_on_level) ); + TRY( h5_free (f, t->map_elem_g2l.items) ); return H5_SUCCESS; } @@ -510,9 +510,9 @@ release_vertices ( h5_file_t* const f ) { h5t_fdata_t* t = f->t; - TRY( h5priv_free (f, t->vertices) ); - TRY( h5priv_free (f, t->num_vertices) ); - TRY( h5priv_free (f, t->map_vertex_g2l.items) ); + TRY( h5_free (f, t->vertices) ); + TRY( h5_free (f, t->num_vertices) ); + TRY( h5_free (f, t->map_vertex_g2l.items) ); return H5_SUCCESS; } @@ -576,7 +576,7 @@ h5tpriv_alloc_num_vertices ( h5t_fdata_t* t = f->t; ssize_t size = num * sizeof (t->vertices[0]); - TRY( t->vertices = h5priv_alloc (f, t->vertices, size) ); + TRY( t->vertices = h5_alloc (f, t->vertices, size) ); TRY( h5priv_alloc_idxmap (f, &t->map_vertex_g2l, num) ); return H5_SUCCESS; diff --git a/src/h5core/h5t_readwrite.c b/src/h5core/h5t_readwrite.c index 283a249..70bdcbc 100644 --- a/src/h5core/h5t_readwrite.c +++ b/src/h5core/h5t_readwrite.c @@ -150,7 +150,7 @@ read_num_vertices ( return h5_error_internal (f, __FILE__, __func__, __LINE__); } ssize_t num_bytes = t->num_levels*sizeof (t->num_vertices[0]); - TRY( t->num_vertices = h5priv_alloc (f, t->num_vertices, num_bytes) ); + TRY( t->num_vertices = h5_alloc (f, t->num_vertices, num_bytes) ); TRY( h5priv_read_dataset_by_name ( f, t->mesh_gid, @@ -192,8 +192,8 @@ read_num_elems ( return h5_error_internal (f, __FILE__, __func__, __LINE__); } size_t size = t->num_levels * sizeof (t->num_elems[0]); - TRY( t->num_elems = h5priv_alloc (f, NULL, size) ); - TRY( t->num_elems_on_level = h5priv_alloc (f, NULL, size) ); + TRY( t->num_elems = h5_alloc (f, NULL, size) ); + TRY( t->num_elems_on_level = h5_alloc (f, NULL, size) ); TRY( h5priv_read_dataset_by_name ( f, t->mesh_gid, diff --git a/src/h5core/h5t_retrieve.c b/src/h5core/h5t_retrieve.c index 8b99843..b524f25 100644 --- a/src/h5core/h5t_retrieve.c +++ b/src/h5core/h5t_retrieve.c @@ -216,7 +216,7 @@ h5t_create_leaf_iterator ( int codim ) { h5t_leaf_iterator_t* it; - TRY( it = h5priv_calloc (f, 1, sizeof (h5t_leaf_iterator_t)) ); + TRY( it = h5_calloc (f, 1, sizeof (h5t_leaf_iterator_t)) ); TRY( h5t_init_leaf_iterator (f, (h5t_iterator_t*)it, codim) ); *iter = (h5t_iterator_t*)it; return H5_SUCCESS; @@ -229,7 +229,7 @@ h5t_create_boundary_face_iterator ( int codim ) { h5t_leaf_iterator_t* it; - TRY( it = h5priv_calloc (f, 1, sizeof (h5t_leaf_iterator_t)) ); + TRY( it = h5_calloc (f, 1, sizeof (h5t_leaf_iterator_t)) ); it->face_idx = 999; // just a high enough number it->elem_idx = -1; it->codim = codim; @@ -255,7 +255,7 @@ h5t_create_mtag_iterator ( const char* name ) { h5t_tag_iterator_t* it; - TRY( it = h5priv_calloc (f, 1, sizeof (*it)) ); + TRY( it = h5_calloc (f, 1, sizeof (*it)) ); h5t_open_mtagset (f, name, &it->tagset); it->elem_idx = -1; it->subentity_idx = 999; @@ -270,7 +270,7 @@ h5t_release_entity_iterator ( h5_file_t* const f, h5t_iterator_t* iter ) { - return h5priv_free (f, iter); + return h5_free (f, iter); } h5_loc_id_t diff --git a/src/h5core/h5t_store.c b/src/h5core/h5t_store.c index 59067a5..9325a84 100644 --- a/src/h5core/h5t_store.c +++ b/src/h5core/h5t_store.c @@ -142,12 +142,12 @@ h5t_add_level ( t->dsinfo_num_elems_on_level.dims[0] = t->num_levels; ssize_t num_bytes = t->num_levels*sizeof (h5_size_t); - TRY( t->num_vertices = h5priv_alloc (f, t->num_vertices, num_bytes) ); + TRY( t->num_vertices = h5_alloc (f, t->num_vertices, num_bytes) ); t->num_vertices[t->cur_level] = -1; - TRY( t->num_elems = h5priv_alloc (f, t->num_elems, num_bytes) ); + TRY( t->num_elems = h5_alloc (f, t->num_elems, num_bytes) ); t->num_elems[t->cur_level] = -1; - TRY( t->num_elems_on_level = h5priv_alloc ( + TRY( t->num_elems_on_level = h5_alloc ( f, t->num_elems_on_level, num_bytes) ); t->num_elems_on_level[t->cur_level] = -1; diff --git a/src/h5core/h5t_store_tetm.c b/src/h5core/h5t_store_tetm.c index 55b5d25..f3db487 100644 --- a/src/h5core/h5t_store_tetm.c +++ b/src/h5core/h5t_store_tetm.c @@ -12,7 +12,7 @@ alloc_tets ( h5t_fdata_t *t = f->t; /* alloc mem for elements */ - TRY ( t->glb_elems.tets = h5priv_alloc ( + TRY ( t->glb_elems.tets = h5_alloc ( f, t->glb_elems.tets, new * sizeof(t->glb_elems.tets[0]) ) ); @@ -22,7 +22,7 @@ alloc_tets ( (new-cur) * sizeof(t->glb_elems.tets[0]) ); /* alloc mem for local data of elements */ - TRY ( t->loc_elems.tets = h5priv_alloc ( + TRY ( t->loc_elems.tets = h5_alloc ( f, t->loc_elems.tets, new * sizeof (t->loc_elems.tets[0]) ) ); diff --git a/src/h5core/h5t_store_trim.c b/src/h5core/h5t_store_trim.c index 901cfb6..3e3c9b4 100644 --- a/src/h5core/h5t_store_trim.c +++ b/src/h5core/h5t_store_trim.c @@ -12,7 +12,7 @@ alloc_triangles ( h5t_fdata_t *t = f->t; /* alloc mem for elements */ - TRY ( t->glb_elems.tris = h5priv_alloc ( + TRY ( t->glb_elems.tris = h5_alloc ( f, t->glb_elems.tris, new * sizeof(t->glb_elems.tris[0]) ) ); @@ -22,7 +22,7 @@ alloc_triangles ( (new-cur) * sizeof(t->glb_elems.tris[0]) ); /* alloc mem for local data of elements */ - TRY ( t->loc_elems.tris = h5priv_alloc ( + TRY ( t->loc_elems.tris = h5_alloc ( f, t->loc_elems.tris, new * sizeof (t->loc_elems.tris[0]) ) ); diff --git a/src/h5core/h5t_tags.c b/src/h5core/h5t_tags.c index 5dde496..e9c390a 100644 --- a/src/h5core/h5t_tags.c +++ b/src/h5core/h5t_tags.c @@ -18,7 +18,7 @@ init_container ( const size_t ntags, h5t_tagcontainer_t* ctn ) { - ctn->names = h5priv_calloc (f, ntags, sizeof(char*)); + ctn->names = h5_calloc (f, ntags, sizeof(char*)); TRY( h5priv_hcreate_string_keyed (f, ntags, &ctn->sets)); return H5_SUCCESS; } @@ -35,13 +35,13 @@ release_tagset ( // release per element structures for (i = 0; i < tagset->num_elems; i++) { if (tagset->elems[i] != NULL) { - TRY( h5priv_free (f, tagset->elems[i]) ); + TRY( h5_free (f, tagset->elems[i]) ); } } // release other memory - TRY( h5priv_free (f, tagset->name) ); - TRY( h5priv_free (f, tagset->values) ); - TRY( h5priv_free (f, tagset) ); + TRY( h5_free (f, tagset->name) ); + TRY( h5_free (f, tagset->values) ); + TRY( h5_free (f, tagset) ); return H5_SUCCESS; } @@ -67,7 +67,7 @@ release_container ( ) { if (ctn->num_sets == 0) return H5_SUCCESS; TRY( h5priv_hwalk (f, &ctn->sets, release_tagset2) ); - TRY( h5priv_free (f, ctn->names) ); + TRY( h5_free (f, ctn->names) ); memset (ctn, 0, sizeof (*ctn)); return H5_SUCCESS; } @@ -154,7 +154,7 @@ add_tagset ( h5t_tagset_t* tagset = NULL; size_t size = (t->num_elems[t->num_levels-1] - 1) * sizeof(*tagset->elems) + sizeof(*tagset); - TRY( tagset = h5priv_calloc (f, 1, size) ); + TRY( tagset = h5_calloc (f, 1, size) ); TRY( tagset->name = h5priv_strdup (f, name) ); tagset->type = type; @@ -399,7 +399,7 @@ add_tag ( ) { // insert new taginfo h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; - TRY( eleminfo = tagset->elems[elem_idx] = h5priv_alloc ( + TRY( eleminfo = tagset->elems[elem_idx] = h5_alloc ( f, tagset->elems[elem_idx], sizeof (*eleminfo) @@ -413,7 +413,7 @@ add_tag ( ti->val_dim = dim; // append values - TRY( tagset->values = h5priv_alloc ( + TRY( tagset->values = h5_alloc ( f, tagset->values, (tagset->num_values+dim) * sizeof (*tagset->values)) ); @@ -456,7 +456,7 @@ set_tag ( void* val ) { if (tagset->elems[elem_idx] == NULL) { - TRY( tagset->elems[elem_idx] = h5priv_calloc ( + TRY( tagset->elems[elem_idx] = h5_calloc ( f, 1, sizeof (*tagset->elems)) ); } h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; @@ -697,17 +697,17 @@ write_tagset ( goto cleanup; // nothing to do } // allocate memory per element (plus 1) - TRY( elems = h5priv_calloc ( + TRY( elems = h5_calloc ( f, num_elems+1, sizeof(*elems)) ); elem = elems; // allocate memory per entity (plus 1) - TRY( entities = h5priv_calloc ( + TRY( entities = h5_calloc ( f, tagset->num_entities+1, sizeof(*entities)) ); entity = entities; // allocate memory for all values - TRY( values = h5priv_calloc ( + TRY( values = h5_calloc ( f, tagset->num_values, sizeof(*values)) ); // build data structures in memory @@ -787,9 +787,9 @@ write_tagset ( values) ); cleanup: - TRY( h5priv_free (f, elems) ); - TRY( h5priv_free (f, entities) ); - TRY( h5priv_free (f, values) ); + TRY( h5_free (f, elems) ); + TRY( h5_free (f, entities) ); + TRY( h5_free (f, values) ); return h5err; } @@ -850,7 +850,7 @@ read_tagset ( hid_t dset_id; ssize_t ssize; TRY( (ssize = h5priv_get_hdf5_objname_by_idx (f, loc_id, idx, NULL, 0)) ); - TRY( (name = h5priv_calloc (f, 1, ++ssize)) ); + TRY( (name = h5_calloc (f, 1, ++ssize)) ); TRY( h5priv_get_hdf5_objname_by_idx (f, loc_id, idx, name, ssize) ); TRY( group_id = h5priv_open_hdf5_group (f, loc_id, name) ); @@ -862,7 +862,7 @@ read_tagset ( TRY( dset_id = h5priv_open_hdf5_dataset (f, group_id, "elems") ); TRY( num_elems = h5priv_get_npoints_of_hdf5_dataset (f, dset_id) ); - TRY( elems = h5priv_calloc (f, num_elems, sizeof(*elems)) ); + TRY( elems = h5_calloc (f, num_elems, sizeof(*elems)) ); h5_dsinfo_t dsinfo; memset (&dsinfo, 0, sizeof (dsinfo)); dsinfo.type_id = t->dtypes.h5t_tag_idx_t; @@ -880,7 +880,7 @@ read_tagset ( size_t num_entities = 0; TRY( dset_id = h5priv_open_hdf5_dataset (f, group_id, "entities") ); TRY( num_entities = h5priv_get_npoints_of_hdf5_dataset (f, dset_id) ); - TRY( entities = h5priv_calloc (f, num_entities, sizeof(*entities)) ); + TRY( entities = h5_calloc (f, num_entities, sizeof(*entities)) ); TRY( h5priv_read_dataset ( f, dset_id, @@ -894,7 +894,7 @@ read_tagset ( size_t num_vals = 0; TRY( dset_id = h5priv_open_hdf5_dataset (f, group_id, "values") ); TRY( num_vals = h5priv_get_npoints_of_hdf5_dataset (f, dset_id) ); - TRY( vals = h5priv_calloc (f, num_vals, sizeof (*vals)) ); + TRY( vals = h5_calloc (f, num_vals, sizeof (*vals)) ); TRY( dsinfo.type_id = h5priv_get_hdf5_dataset_type (f, dset_id) ); TRY( h5priv_read_dataset ( f, @@ -920,7 +920,7 @@ read_tagset ( dim, &vals[entity->idx] ) ); } - TRY( h5priv_free (f, name) ); + TRY( h5_free (f, name) ); return H5_SUCCESS; }