summaryrefslogtreecommitdiffstats
path: root/hl/src/H5TB.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-28 00:42:48 (GMT)
committerGitHub <noreply@github.com>2023-06-28 00:42:48 (GMT)
commitd278ce1f21903c33c6b28e8acb827e94275d4421 (patch)
treed52c322015ac8ce3b8fb992958ab8be1f13d4886 /hl/src/H5TB.c
parent942739e6fbea0ebf736c35f461e1386396b54e11 (diff)
downloadhdf5-d278ce1f21903c33c6b28e8acb827e94275d4421.zip
hdf5-d278ce1f21903c33c6b28e8acb827e94275d4421.tar.gz
hdf5-d278ce1f21903c33c6b28e8acb827e94275d4421.tar.bz2
Remove HD/hbool_t from high-level lib (#3183)
Diffstat (limited to 'hl/src/H5TB.c')
-rw-r--r--hl/src/H5TB.c130
1 files changed, 65 insertions, 65 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index dd938bf..4049796 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -20,7 +20,7 @@
*-------------------------------------------------------------------------
*/
-static hbool_t H5TB_find_field(const char *field, const char *field_list);
+static bool H5TB_find_field(const char *field, const char *field_list);
static herr_t H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_name,
hsize_t nfields, hid_t tid);
@@ -163,7 +163,7 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
if (NULL == (member_name = H5Tget_member_name(mem_type_id, (unsigned)i)))
goto out;
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
/* attach the attribute */
if (H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
@@ -185,7 +185,7 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
goto out;
for (i = 0; i < nfields; i++) {
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
if ((attr_id = H5Acreate2(did, attr_name, field_types[i], sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -1229,9 +1229,9 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
if (H5TBget_table_info(loc_id, dset_name, &nfields, &ntotal_records) < 0)
goto out;
- if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
- if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -1251,7 +1251,7 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
read_nrecords = ntotal_records - read_start;
if (read_nrecords) {
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, src_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)read_nrecords, src_size)))
goto out;
/* read the records after the deleted one(s) */
@@ -1317,11 +1317,11 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
out:
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (src_offset)
- HDfree(src_offset);
+ free(src_offset);
if (src_sizes)
- HDfree(src_sizes);
+ free(src_sizes);
if (mem_type_id > 0)
if (H5Tclose(mem_type_id) < 0)
ret_val = -1;
@@ -1401,7 +1401,7 @@ H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
goto out;
read_nrecords = ntotal_records - start;
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)read_nrecords, type_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)read_nrecords, type_size)))
goto out;
/* read the records after the inserted one(s) */
@@ -1473,7 +1473,7 @@ H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
out:
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (sid > 0)
if (H5Sclose(sid) < 0)
ret_val = -1;
@@ -1543,9 +1543,9 @@ H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize
if (H5TBget_table_info(loc_id, dset_name1, &nfields, &ntotal_records) < 0)
goto out;
- if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
- if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -1573,7 +1573,7 @@ H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize
if (0 == (type_size1 = H5Tget_size(tid)))
goto out;
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
@@ -1601,11 +1601,11 @@ H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize
out:
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (src_offset)
- HDfree(src_offset);
+ free(src_offset);
if (src_sizes)
- HDfree(src_sizes);
+ free(src_sizes);
if (tid > 0)
if (H5Tclose(tid) < 0)
ret_val = -1;
@@ -1696,9 +1696,9 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
if (H5TBget_table_info(loc_id1, dset_name1, &nfields, &nrecords) < 0)
goto out;
- if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
- if (NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -1773,7 +1773,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
goto out;
/* alloc fill value attribute buffer */
- if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(type_size)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)malloc(type_size)))
goto out;
/* get the fill value attributes */
@@ -1796,7 +1796,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
/* get the member offset */
member_offset = H5Tget_member_offset(tid_3, (unsigned)i);
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -1823,7 +1823,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
* read data from 1st table
*-------------------------------------------------------------------------
*/
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
@@ -1856,7 +1856,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
if (H5Sclose(m_sid) < 0)
goto out;
m_sid = H5I_INVALID_HID;
- HDfree(tmp_buf);
+ free(tmp_buf);
tmp_buf = NULL;
/*-------------------------------------------------------------------------
@@ -1889,7 +1889,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
*-------------------------------------------------------------------------
*/
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
@@ -1919,13 +1919,13 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
out:
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (tmp_fill_buf)
- HDfree(tmp_fill_buf);
+ free(tmp_fill_buf);
if (src_offset)
- HDfree(src_offset);
+ free(src_offset);
if (src_sizes)
- HDfree(src_sizes);
+ free(src_sizes);
if (member_type_id > 0)
if (H5Tclose(member_type_id) < 0)
ret_val = -1;
@@ -2035,7 +2035,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
char *member_name = NULL;
unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
- hbool_t inserted;
+ bool inserted;
herr_t ret_val = -1;
/* check the arguments */
@@ -2087,7 +2087,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
goto out;
/* alloc fill value attribute buffer */
- if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc(total_size)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)malloc(total_size)))
goto out;
/* get the fill value attributes */
@@ -2108,7 +2108,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
goto out;
curr_offset = 0;
- inserted = FALSE;
+ inserted = false;
/* insert the old fields, counting with the new one */
for (i = 0; i < nfields + 1; i++) {
@@ -2129,7 +2129,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
curr_offset += new_member_size;
- inserted = TRUE;
+ inserted = true;
} /* end if */
else {
/* get the member name */
@@ -2188,7 +2188,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
*-------------------------------------------------------------------------
*/
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, (size_t)total_size)))
goto out;
/* define a hyperslab in the dataset of the size of the records */
@@ -2296,7 +2296,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
/* get the member offset */
member_offset = H5Tget_member_offset(tid_3, (unsigned)i);
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -2319,7 +2319,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
*-------------------------------------------------------------------------
*/
if (fill_data) {
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)(nfields - 1));
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)(nfields - 1));
/* get the member type */
if ((member_type_id = H5Tget_member_type(tid_3, (unsigned)nfields - 1)) < 0)
@@ -2346,9 +2346,9 @@ out:
if (member_name)
H5free_memory(member_name);
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (tmp_fill_buf)
- HDfree(tmp_fill_buf);
+ free(tmp_fill_buf);
if (preserve_id > 0)
if (H5Pclose(preserve_id) < 0)
ret_val = -1;
@@ -2448,7 +2448,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
char *member_name = NULL;
unsigned char *tmp_buf = NULL;
unsigned char *tmp_fill_buf = NULL;
- htri_t has_fill = FALSE;
+ htri_t has_fill = false;
herr_t ret_val = -1;
/* check the arguments */
@@ -2544,7 +2544,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
curr_offset = 0;
/* alloc fill value attribute buffer */
- if (NULL == (tmp_fill_buf = (unsigned char *)HDmalloc((size_t)type_size2)))
+ if (NULL == (tmp_fill_buf = (unsigned char *)malloc((size_t)type_size2)))
goto out;
/*-------------------------------------------------------------------------
@@ -2581,7 +2581,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
*-------------------------------------------------------------------------
*/
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
/* check if we have the _FILL attribute */
if ((has_fill = H5Aexists(did_1, attr_name)) < 0)
@@ -2653,7 +2653,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
if (H5Tinsert(read_type_id, member_name, (size_t)0, member_type_id) < 0)
goto out;
- if (NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, member_size)))
+ if (NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, member_size)))
goto out;
/* read */
@@ -2698,7 +2698,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
goto out;
write_type_id = H5I_INVALID_HID;
- HDfree(tmp_buf);
+ free(tmp_buf);
tmp_buf = NULL;
} /* end if */
@@ -2758,7 +2758,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* get the member offset */
member_offset = H5Tget_member_offset(tid_3, (unsigned)i);
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
if ((attr_id = H5Acreate2(did_3, attr_name, member_type_id, sid_1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -2788,9 +2788,9 @@ out:
if (member_name)
H5free_memory(member_name);
if (tmp_fill_buf)
- HDfree(tmp_fill_buf);
+ free(tmp_fill_buf);
if (tmp_buf)
- HDfree(tmp_buf);
+ free(tmp_buf);
if (attr_id > 0)
if (H5Aclose(attr_id) < 0)
ret_val = -1;
@@ -2878,7 +2878,7 @@ H5TBAget_title(hid_t loc_id, char *table_title)
*
* Purpose: Read the table attribute fill values
*
- * Return: Success: TRUE/FALSE, Failure: -1
+ * Return: Success: true/false, Failure: -1
*
* Programmer: Pedro Vicente
*
@@ -2896,7 +2896,7 @@ H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char
hsize_t i;
size_t *src_offset = NULL;
char attr_name[255];
- htri_t has_fill = FALSE;
+ htri_t has_fill = false;
htri_t ret_val = -1;
/* check the arguments */
@@ -2907,7 +2907,7 @@ H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char
if (H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
- if (NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
+ if (NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -2915,7 +2915,7 @@ H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char
goto out;
for (i = 0; i < nfields; i++) {
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_FILL", (int)i);
/* Check if we have the _FILL attribute */
if ((has_fill = H5Aexists(dset_id, attr_name)) < 0)
@@ -2931,7 +2931,7 @@ H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char
out:
if (src_offset)
- HDfree(src_offset);
+ free(src_offset);
return ret_val;
} /* end H5TBAget_fill() */
@@ -3150,7 +3150,7 @@ out:
*
* Purpose: Find a string field
*
- * Return: Success: TRUE/FALSE, Failure: N/A
+ * Return: Success: true/false, Failure: N/A
*
* Programmer: Pedro Vicente
*
@@ -3158,7 +3158,7 @@ out:
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE static hbool_t
+H5_ATTR_PURE static bool
H5TB_find_field(const char *field, const char *field_list)
{
const char *start = field_list;
@@ -3166,22 +3166,22 @@ H5TB_find_field(const char *field, const char *field_list)
/* check the arguments */
if (field == NULL)
- return FALSE;
+ return false;
if (field_list == NULL)
- return FALSE;
+ return false;
- while ((end = HDstrstr(start, ",")) != 0) {
+ while ((end = strstr(start, ",")) != 0) {
ptrdiff_t count = end - start;
- if (HDstrncmp(start, field, (size_t)count) == 0 && (size_t)count == HDstrlen(field))
- return TRUE;
+ if (strncmp(start, field, (size_t)count) == 0 && (size_t)count == strlen(field))
+ return true;
start = end + 1;
} /* end while */
- if (HDstrncmp(start, field, HDstrlen(field)) == 0)
- return TRUE;
+ if (strncmp(start, field, strlen(field)) == 0)
+ return true;
- return FALSE;
+ return false;
} /* end H5TB_find_field() */
/*-------------------------------------------------------------------------
@@ -3228,7 +3228,7 @@ H5TB_attach_attributes(const char *table_title, hid_t loc_id, const char *dset_n
if (NULL == (member_name = H5Tget_member_name(tid, (unsigned)i)))
goto out;
- HDsnprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
+ snprintf(attr_name, sizeof(attr_name), "FIELD_%d_NAME", (int)i);
/* attach the attribute */
if (H5LTset_attribute_string(loc_id, dset_name, attr_name, member_name) < 0)
@@ -3279,11 +3279,11 @@ H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const si
if (H5TBget_table_info(loc_id, dset_name, &nfields, NULL) < 0)
goto out;
- if (NULL == (fnames = (char **)HDcalloc(sizeof(char *), (size_t)nfields)))
+ if (NULL == (fnames = (char **)calloc(sizeof(char *), (size_t)nfields)))
goto out;
for (i = 0; i < nfields; i++)
- if (NULL == (fnames[i] = (char *)HDmalloc(HLTB_MAX_FIELD_LEN)))
+ if (NULL == (fnames[i] = (char *)malloc(HLTB_MAX_FIELD_LEN)))
goto out;
/* get field info */
@@ -3321,8 +3321,8 @@ out:
if (fnames) {
for (i = 0; i < nfields; i++)
if (fnames[i])
- HDfree(fnames[i]);
- HDfree(fnames);
+ free(fnames[i]);
+ free(fnames);
} /* end if */
if (mtype_id > 0)
if (H5Tclose(mtype_id) < 0)