From 6df077953ed8be3ac9ed247aaeac0c7f502161c9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 28 Jun 2023 07:30:54 -0700 Subject: Rename HDqsort() to qsort() (#3193) * Rename HDqsort() to qsort() * Committing clang-format changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5Aint.c | 8 ++++---- src/H5Cimage.c | 4 ++-- src/H5Dchunk.c | 4 ++-- src/H5Dmpio.c | 20 ++++++++++---------- src/H5FDint.c | 2 +- src/H5FDonion_index.c | 8 ++++---- src/H5FDsubfiling/H5subfiling_common.c | 2 +- src/H5Glink.c | 8 ++++---- src/H5private.h | 3 --- test/API/titerate.c | 8 ++++---- test/API/tselect.c | 4 ++-- test/titerate.c | 8 ++++---- test/tselect.c | 4 ++-- test/tskiplist.c | 4 ++-- 14 files changed, 42 insertions(+), 45 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index ad6e076..0803ebe 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1885,18 +1885,18 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_orde /* Pick appropriate comparison routine */ if (idx_type == H5_INDEX_NAME) { if (order == H5_ITER_INC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_inc); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_inc); else if (order == H5_ITER_DEC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_dec); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_dec); else HDassert(order == H5_ITER_NATIVE); } /* end if */ else { HDassert(idx_type == H5_INDEX_CRT_ORDER); if (order == H5_ITER_INC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_inc); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_inc); else if (order == H5_ITER_DEC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_dec); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_dec); else HDassert(order == H5_ITER_NATIVE); } /* end else */ diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 69def29..8582d5d 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1062,8 +1062,8 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array.") /* Sort the entries */ - HDqsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image, - sizeof(H5C_image_entry_t), H5C__image_entry_cmp); + qsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image, + sizeof(H5C_image_entry_t), H5C__image_entry_cmp); } /* end if */ else { /* cancel creation of metadata cache image */ HDassert(cache_ptr->image_entries == NULL); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index a26eb04..2f86d8e 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -5665,8 +5665,8 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ } if (need_sort) - HDqsort(chunk_fill_info->chunk_info, chunk_fill_info->num_chunks, - sizeof(struct chunk_coll_fill_info), H5D__chunk_cmp_coll_fill_info); + qsort(chunk_fill_info->chunk_info, chunk_fill_info->num_chunks, + sizeof(struct chunk_coll_fill_info), H5D__chunk_cmp_coll_fill_info); /* Allocate buffer for block lengths if necessary */ if (!all_same_block_len) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index ada077e..a9940c7 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1524,8 +1524,8 @@ H5D__link_piece_collective_io(H5D_io_info_t *io_info, int H5_ATTR_UNUSED mpi_ran /* Sort sel_pieces if necessary */ if (need_sort) - HDqsort(io_info->sel_pieces, io_info->pieces_added, sizeof(io_info->sel_pieces[0]), - H5D__cmp_piece_addr); + qsort(io_info->sel_pieces, io_info->pieces_added, sizeof(io_info->sel_pieces[0]), + H5D__cmp_piece_addr); /* Allocate chunking information */ if (NULL == (chunk_mtype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype)))) @@ -3219,8 +3219,8 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const /* Ensure the chunk list is sorted in ascending order of offset in the file */ if (need_sort) - HDqsort(local_info_array, num_chunks_selected, sizeof(H5D_filtered_collective_io_info_t), - H5D__cmp_filtered_collective_io_info_entry); + qsort(local_info_array, num_chunks_selected, sizeof(H5D_filtered_collective_io_info_t), + H5D__cmp_filtered_collective_io_info_entry); #ifdef H5Dmpio_DEBUG H5D__mpio_dump_collective_filtered_chunk_list(local_info_array, num_chunks_selected, mpi_rank); @@ -3527,8 +3527,8 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun HDmemset(num_chunks_assigned_map, 0, (size_t)mpi_size * sizeof(*num_chunks_assigned_map)); /* Sort collective chunk list according to chunk index */ - HDqsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), - H5D__cmp_chunk_redistribute_info); + qsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), + H5D__cmp_chunk_redistribute_info); /* * Process all chunks in the collective chunk list. @@ -3609,8 +3609,8 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun * algorithm may be devised that doesn't rely on frail sorting, * but the current implementation is a quick and naive approach. */ - HDqsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), - H5D__cmp_chunk_redistribute_info_orig_owner); + qsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), + H5D__cmp_chunk_redistribute_info_orig_owner); } if (all_ranks_involved) { @@ -4995,8 +4995,8 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t * ascending order of offset in the file */ if (need_sort) - HDqsort(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), - H5D__cmp_filtered_collective_io_info_entry); + qsort(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), + H5D__cmp_filtered_collective_io_info_entry); done: H5MM_free(gathered_array); diff --git a/src/H5FDint.c b/src/H5FDint.c index 847941f..b0fe040 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -2293,7 +2293,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t } /* sort the srt_tmp array */ - HDqsort(srt_tmp, count, sizeof(struct H5FD_vsrt_tmp_t), H5FD__vsrt_tmp_cmp); + qsort(srt_tmp, count, sizeof(struct H5FD_vsrt_tmp_t), H5FD__vsrt_tmp_cmp); /* verify no duplicate entries */ i = 1; diff --git a/src/H5FDonion_index.c b/src/H5FDonion_index.c index 0ed1afe..aca0780 100644 --- a/src/H5FDonion_index.c +++ b/src/H5FDonion_index.c @@ -882,8 +882,8 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i } /* Sort the new archival list */ - HDqsort(new_aix.list, new_aix.n_entries, sizeof(H5FD_onion_index_entry_t), - H5FD__onion_archival_index_list_sort_cmp); + qsort(new_aix.list, new_aix.n_entries, sizeof(H5FD_onion_index_entry_t), + H5FD__onion_archival_index_list_sort_cmp); /* Add the old archival index entries to a 'kept' list containing the * old archival list entries that are not also included in the revision @@ -924,8 +924,8 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i } /* Sort this list */ - HDqsort(aix->list, aix->n_entries, sizeof(H5FD_onion_index_entry_t), - H5FD__onion_archival_index_list_sort_cmp); + qsort(aix->list, aix->n_entries, sizeof(H5FD_onion_index_entry_t), + H5FD__onion_archival_index_list_sort_cmp); done: /* Free the temporary lists */ diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 8fea794..7dac2db 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -1359,7 +1359,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't gather application topology info"); /* Sort the list according to the node local lead rank values */ - HDqsort(app_layout->layout, (size_t)app_layout->world_size, sizeof(layout_t), compare_layout_nodelocal); + qsort(app_layout->layout, (size_t)app_layout->world_size, sizeof(layout_t), compare_layout_nodelocal); /* * Count the number of nodes by checking how many diff --git a/src/H5Glink.c b/src/H5Glink.c index f3bf53e..37aad84 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -416,18 +416,18 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_orde /* Pick appropriate sorting routine */ if (idx_type == H5_INDEX_NAME) { if (order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); else if (order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); else HDassert(order == H5_ITER_NATIVE); } /* end if */ else { HDassert(idx_type == H5_INDEX_CRT_ORDER); if (order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); else if (order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); else HDassert(order == H5_ITER_NATIVE); } /* end else */ diff --git a/src/H5private.h b/src/H5private.h index ec0604b..1bccc9b 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -970,9 +970,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) #endif -#ifndef HDqsort -#define HDqsort(M, N, Z, F) qsort(M, N, Z, F) -#endif /* clang-format off */ #ifdef H5_HAVE_RAND_R diff --git a/test/API/titerate.c b/test/API/titerate.c index 6d86130..e528803 100644 --- a/test/API/titerate.c +++ b/test/API/titerate.c @@ -205,7 +205,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); @@ -749,7 +749,7 @@ test_iter_group_large(hid_t fapl) CHECK(ret, FAIL, "H5Tclose"); /* Need to sort the names in the root group, cause that's what the library does */ - HDqsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); + qsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); /* Iterate through the file to see members of the root group */ curr_name = &names[0]; @@ -848,7 +848,7 @@ test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); @@ -905,7 +905,7 @@ test_grp_memb_funcs(hid_t fapl) VERIFY(ret, FAIL, "H5Lget_name_by_idx"); /* Sort the dataset names */ - HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Compare object names */ for (i = 0; i < (int)ginfo.nlinks; i++) { diff --git a/test/API/tselect.c b/test/API/tselect.c index a2f377d..292bf84 100644 --- a/test/API/tselect.c +++ b/test/API/tselect.c @@ -1383,8 +1383,8 @@ test_select_hyper_stride(hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Sort the locations into the proper order */ - HDqsort(loc1, (size_t)72, sizeof(size_t), compare_size_t); - HDqsort(loc2, (size_t)72, sizeof(size_t), compare_size_t); + qsort(loc1, (size_t)72, sizeof(size_t), compare_size_t); + qsort(loc2, (size_t)72, sizeof(size_t), compare_size_t); /* Compare data read with data written out */ for (i = 0; i < 72; i++) { tbuf = wbuf + loc1[i]; diff --git a/test/titerate.c b/test/titerate.c index 674405c..458be8e 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -194,7 +194,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); @@ -706,7 +706,7 @@ test_iter_group_large(hid_t fapl) CHECK(ret, FAIL, "H5Tclose"); /* Need to sort the names in the root group, cause that's what the library does */ - HDqsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); + qsort(names, (size_t)(ITER_NGROUPS + 2), sizeof(iter_info), iter_strcmp2); /* Iterate through the file to see members of the root group */ curr_name = &names[0]; @@ -804,7 +804,7 @@ test_grp_memb_funcs(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); /* Sort the dataset names */ - HDqsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(dnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Iterate through the datasets in the root group in various ways */ file = H5Fopen(DATAFILE, H5F_ACC_RDONLY, fapl); @@ -861,7 +861,7 @@ test_grp_memb_funcs(hid_t fapl) VERIFY(ret, FAIL, "H5Lget_name_by_idx"); /* Sort the dataset names */ - HDqsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); + qsort(obj_names, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp); /* Compare object names */ for (i = 0; i < (int)ginfo.nlinks; i++) { diff --git a/test/tselect.c b/test/tselect.c index 97061fe..8079353 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1382,8 +1382,8 @@ test_select_hyper_stride(hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Sort the locations into the proper order */ - HDqsort(loc1, (size_t)72, sizeof(size_t), compare_size_t); - HDqsort(loc2, (size_t)72, sizeof(size_t), compare_size_t); + qsort(loc1, (size_t)72, sizeof(size_t), compare_size_t); + qsort(loc2, (size_t)72, sizeof(size_t), compare_size_t); /* Compare data read with data written out */ for (i = 0; i < 72; i++) { tbuf = wbuf + loc1[i]; diff --git a/test/tskiplist.c b/test/tskiplist.c index 1d01839..07fe5dc 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -100,13 +100,13 @@ test_skiplist_init(void) HDmemcpy(sort_rand_num, rand_num, sizeof(int) * NUM_ELEMS); /* Sort random numbers */ - HDqsort(sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_sort); + qsort(sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_sort); /* Copy random values to reverse sorted array */ HDmemcpy(rev_sort_rand_num, rand_num, sizeof(int) * NUM_ELEMS); /* Sort random numbers */ - HDqsort(rev_sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_rev_sort); + qsort(rev_sort_rand_num, (size_t)NUM_ELEMS, sizeof(int), tst_rev_sort); } /* end test_skiplist_init() */ /**************************************************************** -- cgit v0.12