From 5b1c9ffe2d7ba0dd906836cb844c7504aa96aa58 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 24 Feb 2012 09:39:17 -0500 Subject: [svn-r21980] Correct HD prefix in tools for *alloc Checked for HD support. --- tools/h5dump/h5dump.c | 8 ++++---- tools/h5dump/h5dump_ddl.c | 8 ++++---- tools/h5dump/h5dump_xml.c | 12 ++++++------ tools/h5jam/h5jamgentest.c | 4 ++-- tools/h5ls/h5ls.c | 8 ++++---- tools/h5repack/h5repack_opttable.c | 6 +++--- tools/h5repack/h5repack_parse.c | 4 ++-- tools/h5stat/h5stat.c | 14 +++++++------- tools/lib/h5diff_array.c | 2 +- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 09dead0..ac9d1d3 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -642,7 +642,7 @@ parse_hsize_list(const char *h_list, subset_d *d) return; /* allocate an array for the integers in the list */ - p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); + p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t)); for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) if(isdigit(*ptr)) { @@ -684,7 +684,7 @@ parse_subset_params(char *dset) if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { *brace++ = '\0'; - s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); parse_hsize_list(brace, &s->start); while (*brace && *brace != ';') @@ -906,7 +906,7 @@ parse_command_line(int argc, const char *argv[]) } /* this will be plenty big enough to hold the info */ - if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { + if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) { goto error; } @@ -1163,7 +1163,7 @@ parse_start: s = last_dset->subset_info; } else { - last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); } /* diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index f53a9d2..8117238 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1502,26 +1502,26 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis * dimensions */ if(!sset->start.data) { /* default to (0, 0, ...) for the start coord */ - sset->start.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); sset->start.len = ndims; } if(!sset->stride.data) { - sset->stride.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); sset->stride.len = ndims; for (i = 0; i < ndims; i++) sset->stride.data[i] = 1; } if(!sset->count.data) { - sset->count.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); sset->count.len = ndims; for (i = 0; i < ndims; i++) sset->count.data[i] = 1; } if(!sset->block.data) { - sset->block.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); + sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); sset->block.len = ndims; for (i = 0; i < ndims; i++) sset->block.data[i] = 1; diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c index 934682c..b92ccdb 100644 --- a/tools/h5dump/h5dump_xml.c +++ b/tools/h5dump/h5dump_xml.c @@ -693,7 +693,7 @@ xml_escape_the_string(const char *str, int slen) } cp = str; - rcp = ncp = (char *) calloc((len + extra + 1), sizeof(char)); + rcp = ncp = (char *) HDcalloc((len + extra + 1), sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -2899,7 +2899,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); if (buf == NULL) goto error; e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2915,7 +2915,7 @@ xml_print_refs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = (char *) calloc((size_t)(ssiz * tsiz), sizeof(char)); + buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char)); if (buf == NULL) { goto error; } @@ -3085,7 +3085,7 @@ xml_print_strs(hid_t did, int source) bp = (char*) buf; if (!is_vlstr) - onestring = (char *) calloc(tsiz, sizeof(char)); + onestring = (char *) HDcalloc(tsiz, sizeof(char)); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -4355,8 +4355,8 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = (char **)calloc(nmembs, sizeof(char *)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + name = (char **)HDcalloc(nmembs, sizeof(char *)); + value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index c64053c..ca3d86c 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -335,7 +335,7 @@ create_textfile(const char *name, size_t size) fd = HDcreat(name,0777); HDassert(fd >= 0); - buf = calloc(size, (size_t)1); + buf = HDcalloc(size, (size_t)1); HDassert(buf); /* fill buf with pattern */ @@ -363,7 +363,7 @@ create_binfile(char *name, off_t size) fd = creat(name,0777); HDassert(fd >= 0); - buf = calloc(size,1); + buf = HDcalloc(size,1); HDassert(buf); /* fill buf with pattern */ diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 9766170..b06f302 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -897,8 +897,8 @@ display_enum_type(hid_t type, int ind) } /* Get the names and raw values of all members */ - name = calloc(nmembs, sizeof(char*)); - value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + name = HDcalloc(nmembs, sizeof(char*)); + value = (unsigned char *)HDcalloc(nmembs, MAX(H5Tget_size(type), dst_size)); for (i=0; isize += n_objs; - table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); + table->objs = (pack_info_t*)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { error_msg("not enough memory for options table\n"); return -1; @@ -147,7 +147,7 @@ int options_table_init( pack_opttbl_t **tbl ) unsigned int i; pack_opttbl_t *table; - if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) + if(NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) { error_msg("not enough memory for options table\n"); return -1; @@ -155,7 +155,7 @@ int options_table_init( pack_opttbl_t **tbl ) table->size = 30; table->nelems = 0; - if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t)))) + if(NULL == (table->objs = (pack_info_t*)HDmalloc(table->size * sizeof(pack_info_t)))) { error_msg("not enough memory for options table\n"); HDfree(table); diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 6fab819..5cdf9d2 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -88,7 +88,7 @@ obj_list_t* parse_filter(const char *str, } n++; - obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); + obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { error_msg("could not allocate object list\n"); @@ -509,7 +509,7 @@ obj_list_t* parse_layout(const char *str, } n++; - obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); + obj_list = (obj_list_t*) HDmalloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { error_msg("could not allocate object list\n"); diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 2155f95..f6ed4b8 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -318,7 +318,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) /* Add attribute count to proper bin */ bin = ceil_log10((unsigned long)oi->num_attrs); if((bin + 1) > iter->attr_nbins) { - iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); + iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->attr_bins); /* Initialize counts for intermediate bins */ @@ -390,7 +390,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) bin = ceil_log10((unsigned long)ginfo.nlinks); if((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ - iter->group_bins = (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); + iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->group_bins); /* Initialize counts for intermediate bins */ @@ -521,7 +521,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) bin = ceil_log10((unsigned long)dims[0]); if((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ - iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long)); + iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->dset_dim_bins); /* Initialize counts for intermediate bins */ @@ -558,7 +558,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_ntypes++; /* Allocate more storage for info about dataset's datatype */ - iter->dset_type_info = (dtype_info_t *)realloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t)); + iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t)); HDassert(iter->dset_type_info); /* Initialize information about datatype */ @@ -741,7 +741,7 @@ freespace_stats(hid_t fid, iter_t *iter) if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0) return(FAIL); else if(nsects) { - if(NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t)))) + if(NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)))) return(FAIL); nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); HDassert(nsects); @@ -757,7 +757,7 @@ freespace_stats(hid_t fid, iter_t *iter) bin = ceil_log10((unsigned long)sect_info[u].size); if(bin >= iter->sect_nbins) { /* Allocate more storage for section info */ - iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); + iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->sect_bins); /* Initialize counts for intermediate bins */ @@ -805,7 +805,7 @@ parse_command_line(int argc, const char *argv[]) struct handler_t *hand = NULL; /* Allocate space to hold the command line info */ - if((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)))==NULL) { + if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t)))==NULL) { error_msg("unable to parse command line arguments \n"); goto error; } diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 172986d..604a825 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -5580,7 +5580,7 @@ int ull2float(unsigned long long ull_value, float *f_value) src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)calloc(1, MAX(src_size, dst_size)); + buf = (unsigned char*)HDcalloc(1, MAX(src_size, dst_size)); HDmemcpy(buf, &ull_value, src_size); -- cgit v0.12