diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 22:48:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 22:48:12 (GMT) |
commit | aebac33a1f290fa5065bce96bb0512317a34c283 (patch) | |
tree | cdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /src | |
parent | 605cea4af60cfcbe03a54f697de392eec75e5a85 (diff) | |
download | hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2 |
Remove HD from memory allocate/free calls (#3195)
* HDcalloc
* HDfree
* HDmalloc
* HDrealloc
Diffstat (limited to 'src')
-rw-r--r-- | src/H5CS.c | 14 | ||||
-rw-r--r-- | src/H5CX.c | 10 | ||||
-rw-r--r-- | src/H5E.c | 8 | ||||
-rw-r--r-- | src/H5Eint.c | 4 | ||||
-rw-r--r-- | src/H5FDdirect.c | 26 | ||||
-rw-r--r-- | src/H5FDint.c | 20 | ||||
-rw-r--r-- | src/H5FDmpio.c | 52 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc.c | 26 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc_int.c | 8 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc_threads.c | 16 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDsubfile_int.c | 20 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDsubfiling.c | 68 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5subfiling_common.c | 114 | ||||
-rw-r--r-- | src/H5Gloc.c | 2 | ||||
-rw-r--r-- | src/H5MM.c | 8 | ||||
-rw-r--r-- | src/H5MMprivate.h | 2 | ||||
-rw-r--r-- | src/H5Tdbg.c | 6 | ||||
-rw-r--r-- | src/H5Tvlen.c | 8 | ||||
-rw-r--r-- | src/H5Z.c | 6 | ||||
-rw-r--r-- | src/H5private.h | 12 | ||||
-rw-r--r-- | src/H5system.c | 6 | ||||
-rw-r--r-- | src/H5timer.c | 2 |
22 files changed, 212 insertions, 226 deletions
@@ -90,8 +90,8 @@ H5CS__get_stack(void) fstack = (H5CS_t *)LocalAlloc( LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ #else - fstack = (H5CS_t *)HDmalloc( - sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ + fstack = + (H5CS_t *)malloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ #endif /* H5_HAVE_WIN_THREADS */ assert(fstack); @@ -183,7 +183,7 @@ H5CS_push(const char *func_name) size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS); /* Don't use H5MM_realloc here */ - const char **x = (const char **)HDrealloc(fstack->rec, na * sizeof(const char *)); + const char **x = (const char **)realloc(fstack->rec, na * sizeof(const char *)); /* (Avoid returning an error from this routine, currently -QAK) */ assert(x); @@ -256,9 +256,9 @@ H5CS_copy_stack(void) /* Allocate a new stack */ /* (Don't use library allocate code, since this code stack supports it) */ - if (NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t)))) + if (NULL == (new_stack = calloc(1, sizeof(H5CS_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack") - if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *)))) + if (NULL == (new_stack->rec = calloc(old_stack->nused, sizeof(const char *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records") /* Copy pointers on old stack to new one */ @@ -301,11 +301,11 @@ H5CS_close_stack(H5CS_t *stack) * and are not allocated, so there's no need to free them. */ if (stack->rec) { - HDfree(stack->rec); + free(stack->rec); stack->rec = NULL; } /* end if */ if (stack) - HDfree(stack); + free(stack); FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_close_stack() */ @@ -696,8 +696,8 @@ H5CX_term_package(void) cnode = H5CX__pop_common(FALSE); /* Free the context node */ - /* (Allocated with HDmalloc() in H5CX_push_special() ) */ - HDfree(cnode); + /* (Allocated with malloc() in H5CX_push_special() ) */ + free(cnode); #ifndef H5_HAVE_THREADSAFE H5CX_head_g = NULL; @@ -736,10 +736,10 @@ H5CX__get_context(void) /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ ctx = (H5CX_node_t **)LocalAlloc(LPTR, sizeof(H5CX_node_t *)); #else - /* Use HDmalloc here since this has to match the HDfree in the + /* Use malloc here since this has to match the free in the * destructor and we want to avoid the codestack there. */ - ctx = (H5CX_node_t **)HDmalloc(sizeof(H5CX_node_t *)); + ctx = (H5CX_node_t **)malloc(sizeof(H5CX_node_t *)); #endif /* H5_HAVE_WIN_THREADS */ assert(ctx); @@ -852,7 +852,7 @@ H5CX_push_special(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Allocate & clear API context node, without using library API routines */ - cnode = (H5CX_node_t *)HDcalloc(1, sizeof(H5CX_node_t)); + cnode = (H5CX_node_t *)calloc(1, sizeof(H5CX_node_t)); assert(cnode); /* Set context info */ @@ -333,10 +333,10 @@ H5E__get_stack(void) /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); #else - /* Use HDmalloc here since this has to match the HDfree in the + /* Use malloc here since this has to match the free in the * destructor and we want to avoid the codestack there. */ - estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); + estack = (H5E_t *)malloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ assert(estack); @@ -1347,10 +1347,10 @@ done: if (va_started) va_end(ap); /* Memory was allocated with HDvasprintf so it needs to be freed - * with HDfree + * with free */ if (tmp) - HDfree(tmp); + free(tmp); FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 2719a41..4b2f185 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -688,10 +688,10 @@ done: if (va_started) va_end(ap); /* Memory was allocated with HDvasprintf so it needs to be freed - * with HDfree + * with free */ if (tmp) - HDfree(tmp); + free(tmp); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 7275bb5..25006ac 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -549,10 +549,10 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad * is to handle correctly the case that the file is in a different file system * than the one where the program is running. */ - /* NOTE: Use HDmalloc and HDfree here to ensure compatibility with - * posix_memalign. + /* NOTE: Use malloc and free here to ensure compatibility with + * posix_memalign(). */ - buf1 = HDmalloc(sizeof(int)); + buf1 = malloc(sizeof(int)); if (posix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "posix_memalign failed") @@ -591,9 +591,9 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } if (buf1) - HDfree(buf1); + free(buf1); if (buf2) - HDfree(buf2); + free(buf2); /* Set return value */ ret_value = (H5FD_t *)file; @@ -1003,8 +1003,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1015,9 +1015,9 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1230,8 +1230,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ buf = (const char *)buf + size; if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1244,9 +1244,9 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; diff --git a/src/H5FDint.c b/src/H5FDint.c index b10c386..2bc50ad 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -2283,7 +2283,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t srt_tmp_size = (count * sizeof(struct H5FD_vsrt_tmp_t)); - if (NULL == (srt_tmp = (H5FD_vsrt_tmp_t *)HDmalloc(srt_tmp_size))) + if (NULL == (srt_tmp = (H5FD_vsrt_tmp_t *)malloc(srt_tmp_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc srt_tmp") @@ -2305,11 +2305,11 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "duplicate addr in vector") } - if ((NULL == (*s_types_ptr = (H5FD_mem_t *)HDmalloc(count * sizeof(H5FD_mem_t)))) || - (NULL == (*s_addrs_ptr = (haddr_t *)HDmalloc(count * sizeof(haddr_t)))) || - (NULL == (*s_sizes_ptr = (size_t *)HDmalloc(count * sizeof(size_t)))) || + if ((NULL == (*s_types_ptr = (H5FD_mem_t *)malloc(count * sizeof(H5FD_mem_t)))) || + (NULL == (*s_addrs_ptr = (haddr_t *)malloc(count * sizeof(haddr_t)))) || + (NULL == (*s_sizes_ptr = (size_t *)malloc(count * sizeof(size_t)))) || (NULL == - (*s_bufs_ptr = (H5_flexible_const_ptr_t *)HDmalloc(count * sizeof(H5_flexible_const_ptr_t))))) { + (*s_bufs_ptr = (H5_flexible_const_ptr_t *)malloc(count * sizeof(H5_flexible_const_ptr_t))))) { HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sorted vector(s)") } @@ -2350,7 +2350,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t done: if (srt_tmp) { - HDfree(srt_tmp); + free(srt_tmp); srt_tmp = NULL; } @@ -2365,25 +2365,25 @@ done: /* free space allocated for sorted vectors */ if (*s_types_ptr) { - HDfree(*s_types_ptr); + free(*s_types_ptr); *s_types_ptr = NULL; } if (*s_addrs_ptr) { - HDfree(*s_addrs_ptr); + free(*s_addrs_ptr); *s_addrs_ptr = NULL; } if (*s_sizes_ptr) { - HDfree(*s_sizes_ptr); + free(*s_sizes_ptr); *s_sizes_ptr = NULL; } if (*s_bufs_ptr) { - HDfree(*s_bufs_ptr); + free(*s_bufs_ptr); *s_bufs_ptr = NULL; } } diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 47375df..52370f1 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1848,9 +1848,9 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ s_sizes, s_bufs) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't sort vector I/O request") - if ((NULL == (mpi_block_lengths = (int *)HDmalloc((size_t)count * sizeof(int)))) || - (NULL == (mpi_displacements = (MPI_Aint *)HDmalloc((size_t)count * sizeof(MPI_Aint)))) || - (NULL == (mpi_bufs = (MPI_Aint *)HDmalloc((size_t)count * sizeof(MPI_Aint))))) { + if ((NULL == (mpi_block_lengths = (int *)malloc((size_t)count * sizeof(int)))) || + (NULL == (mpi_displacements = (MPI_Aint *)malloc((size_t)count * sizeof(MPI_Aint)))) || + (NULL == (mpi_bufs = (MPI_Aint *)malloc((size_t)count * sizeof(MPI_Aint))))) { HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc mpi block lengths / displacement") } @@ -1924,9 +1924,9 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ if (!sub_types) { assert(!sub_types_created); - if (NULL == (sub_types = HDmalloc((size_t)count * sizeof(MPI_Datatype)))) + if (NULL == (sub_types = malloc((size_t)count * sizeof(MPI_Datatype)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types array") - if (NULL == (sub_types_created = (uint8_t *)HDcalloc((size_t)count, 1))) { + if (NULL == (sub_types_created = (uint8_t *)calloc((size_t)count, 1))) { H5MM_free(sub_types); sub_types = NULL; HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types created array") @@ -1984,15 +1984,15 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* Free up memory used to build types */ assert(mpi_block_lengths); - HDfree(mpi_block_lengths); + free(mpi_block_lengths); mpi_block_lengths = NULL; assert(mpi_displacements); - HDfree(mpi_displacements); + free(mpi_displacements); mpi_displacements = NULL; assert(mpi_bufs); - HDfree(mpi_bufs); + free(mpi_bufs); mpi_bufs = NULL; if (sub_types) { @@ -2002,9 +2002,9 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ if (sub_types_created[i]) MPI_Type_free(&sub_types[i]); - HDfree(sub_types); + free(sub_types); sub_types = NULL; - HDfree(sub_types_created); + free(sub_types_created); sub_types_created = NULL; } @@ -2032,24 +2032,24 @@ done: /* free sorted vectors if they exist */ if (!vector_was_sorted) if (s_types) { - HDfree(s_types); + free(s_types); s_types = NULL; } /* Clean up on error */ if (ret_value < 0) { if (mpi_block_lengths) { - HDfree(mpi_block_lengths); + free(mpi_block_lengths); mpi_block_lengths = NULL; } if (mpi_displacements) { - HDfree(mpi_displacements); + free(mpi_displacements); mpi_displacements = NULL; } if (mpi_bufs) { - HDfree(mpi_bufs); + free(mpi_bufs); mpi_bufs = NULL; } @@ -2060,9 +2060,9 @@ done: if (sub_types_created[i]) MPI_Type_free(&sub_types[i]); - HDfree(sub_types); + free(sub_types); sub_types = NULL; - HDfree(sub_types_created); + free(sub_types_created); sub_types_created = NULL; } } @@ -2198,7 +2198,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* free sorted addrs vector if it exists */ if (!vector_was_sorted) if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } @@ -2458,15 +2458,15 @@ done: /* free sorted vectors if they exist */ if (!vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } @@ -2598,15 +2598,15 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co /* free sorted vectors if they exist */ if (!vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } @@ -2762,15 +2762,15 @@ done: /* Cleanup on error */ if (ret_value < 0 && !vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 190c8c4..1cc4f87 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -936,7 +936,7 @@ H5FD__ioc_close_int(H5FD_ioc_t *file_ptr) } done: - HDfree(file_ptr->file_path); + free(file_ptr->file_path); file_ptr->file_path = NULL; H5MM_free(file_ptr->file_dir); @@ -1486,7 +1486,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file dirname"); /* Try to open the subfiling configuration file and get the number of IOCs */ - if (NULL == (tmp_filename = HDmalloc(PATH_MAX))) + if (NULL == (tmp_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate config file name buffer"); @@ -1576,7 +1576,7 @@ done: if (H5_mpi_info_free(&info) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI info object"); - HDfree(tmp_filename); + free(tmp_filename); H5MM_free(file_dirname); H5MM_free(base_filename); @@ -1633,9 +1633,9 @@ H5FD__ioc_write_vector_internal(H5FD_t *_file, uint32_t count, H5FD_mem_t H5_ATT * that blocking write calls do not return early before the data is * actually written. */ - if (NULL == (sf_io_reqs = HDcalloc((size_t)count, sizeof(*sf_io_reqs)))) + if (NULL == (sf_io_reqs = calloc((size_t)count, sizeof(*sf_io_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate I/O request array"); - if (NULL == (mpi_reqs = HDmalloc(2 * (size_t)count * sizeof(*mpi_reqs)))) + if (NULL == (mpi_reqs = malloc(2 * (size_t)count * sizeof(*mpi_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate MPI request array"); /* Each pass thru the following should queue an MPI write @@ -1669,12 +1669,12 @@ H5FD__ioc_write_vector_internal(H5FD_t *_file, uint32_t count, H5FD_mem_t H5_ATT H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't complete I/O requests"); done: - HDfree(mpi_reqs); + free(mpi_reqs); if (sf_io_reqs) { for (size_t i = 0; i < count; i++) - HDfree(sf_io_reqs[i]); - HDfree(sf_io_reqs); + free(sf_io_reqs[i]); + free(sf_io_reqs); } H5_SUBFILING_FUNC_LEAVE; @@ -1712,9 +1712,9 @@ H5FD__ioc_read_vector_internal(H5FD_t *_file, uint32_t count, haddr_t addrs[], s * that the actual I/O call (currently, HDpread) has completed and * the data read from the file has been transferred to the caller. */ - if (NULL == (sf_io_reqs = HDcalloc((size_t)count, sizeof(*sf_io_reqs)))) + if (NULL == (sf_io_reqs = calloc((size_t)count, sizeof(*sf_io_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate I/O request array"); - if (NULL == (mpi_reqs = HDmalloc((size_t)count * sizeof(*mpi_reqs)))) + if (NULL == (mpi_reqs = malloc((size_t)count * sizeof(*mpi_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate MPI request array"); for (size_t i = 0; i < (size_t)count; i++) { @@ -1741,12 +1741,12 @@ H5FD__ioc_read_vector_internal(H5FD_t *_file, uint32_t count, haddr_t addrs[], s H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't complete I/O requests"); done: - HDfree(mpi_reqs); + free(mpi_reqs); if (sf_io_reqs) { for (size_t i = 0; i < count; i++) - HDfree(sf_io_reqs[i]); - HDfree(sf_io_reqs); + free(sf_io_reqs[i]); + free(sf_io_reqs); } H5_SUBFILING_FUNC_LEAVE; diff --git a/src/H5FDsubfiling/H5FDioc_int.c b/src/H5FDsubfiling/H5FDioc_int.c index afe6b16..fdde752 100644 --- a/src/H5FDsubfiling/H5FDioc_int.c +++ b/src/H5FDsubfiling/H5FDioc_int.c @@ -167,7 +167,7 @@ ioc__write_independent_async(int64_t context_id, int64_t offset, int64_t element * Allocate the I/O request object that will * be returned to the caller */ - if (NULL == (sf_io_request = HDmalloc(sizeof(io_req_t)))) + if (NULL == (sf_io_request = malloc(sizeof(io_req_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "couldn't allocate I/O request"); H5_CHECK_OVERFLOW(ioc_start, int64_t, int); @@ -228,7 +228,7 @@ done: } } - HDfree(sf_io_request); + free(sf_io_request); *io_req = NULL; } @@ -320,7 +320,7 @@ ioc__read_independent_async(int64_t context_id, int64_t offset, int64_t elements * Allocate the I/O request object that will * be returned to the caller */ - if (NULL == (sf_io_request = HDmalloc(sizeof(io_req_t)))) + if (NULL == (sf_io_request = malloc(sizeof(io_req_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_READERROR, FAIL, "couldn't allocate I/O request"); H5_CHECK_OVERFLOW(ioc_start, int64_t, int); @@ -402,7 +402,7 @@ done: } } - HDfree(sf_io_request); + free(sf_io_request); *io_req = NULL; } diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c index 64529b9..e0d351f 100644 --- a/src/H5FDsubfiling/H5FDioc_threads.c +++ b/src/H5FDsubfiling/H5FDioc_threads.c @@ -125,7 +125,7 @@ initialize_ioc_threads(void *_sf_context) * Allocate and initialize IOC data that will be passed * to the IOC main thread */ - if (NULL == (ioc_data = HDmalloc(sizeof(*ioc_data)))) + if (NULL == (ioc_data = malloc(sizeof(*ioc_data)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, (-1), "can't allocate IOC data for IOC main thread"); ioc_data->sf_context_id = sf_context->sf_context_id; @@ -242,7 +242,7 @@ finalize_ioc_threads(void *_sf_context) H5_SUBFILING_DONE_ERROR(H5E_IO, H5E_CLOSEERROR, -1, "%" PRId32 " I/O requests failed", ioc_data->io_queue.num_failed); - HDfree(ioc_data); + free(ioc_data); sf_context->ioc_data = NULL; H5_SUBFILING_FUNC_LEAVE; @@ -739,7 +739,7 @@ ioc_file_queue_write_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_ #endif /* Allocate space to receive data sent from the client */ - if (NULL == (recv_buf = HDmalloc((size_t)data_size))) { + if (NULL == (recv_buf = malloc((size_t)data_size))) { send_nack = TRUE; H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, -1, "couldn't allocate receive buffer for data"); } @@ -836,7 +836,7 @@ done: H5_SUBFILING_DONE_ERROR(H5E_IO, H5E_WRITEERROR, -1, "couldn't send NACK to client"); } - HDfree(recv_buf); + free(recv_buf); H5_SUBFILING_FUNC_LEAVE; } /* ioc_file_queue_write_indep() */ @@ -935,7 +935,7 @@ ioc_file_queue_read_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_C #endif /* Allocate space to send data read from file to client */ - if (NULL == (send_buf = HDmalloc((size_t)data_size))) { + if (NULL == (send_buf = malloc((size_t)data_size))) { if (need_data_tag) { send_nack = TRUE; send_empty_buf = FALSE; @@ -1010,7 +1010,7 @@ done: H5_SUBFILING_MPI_DONE_ERROR(-1, "MPI_Send failed", mpi_code); } - HDfree(send_buf); + free(send_buf); return ret_value; } /* end ioc_file_queue_read_indep() */ @@ -1273,7 +1273,7 @@ ioc_io_queue_alloc_entry(void) { ioc_io_queue_entry_t *q_entry_ptr = NULL; - q_entry_ptr = (ioc_io_queue_entry_t *)HDmalloc(sizeof(ioc_io_queue_entry_t)); + q_entry_ptr = (ioc_io_queue_entry_t *)malloc(sizeof(ioc_io_queue_entry_t)); if (q_entry_ptr) { @@ -1703,7 +1703,7 @@ ioc_io_queue_free_entry(ioc_io_queue_entry_t *q_entry_ptr) q_entry_ptr->magic = 0; - HDfree(q_entry_ptr); + free(q_entry_ptr); q_entry_ptr = NULL; diff --git a/src/H5FDsubfiling/H5FDsubfile_int.c b/src/H5FDsubfiling/H5FDsubfile_int.c index 3a60af1..b8b2725 100644 --- a/src/H5FDsubfiling/H5FDsubfile_int.c +++ b/src/H5FDsubfiling/H5FDsubfile_int.c @@ -101,10 +101,10 @@ H5FD__subfiling__truncate_sub_files(hid_t context_id, int64_t logical_file_eof, num_subfiles_owned = sf_context->sf_num_fids; - if (NULL == (recv_reqs = HDmalloc((size_t)num_subfiles_owned * sizeof(*recv_reqs)))) + if (NULL == (recv_reqs = malloc((size_t)num_subfiles_owned * sizeof(*recv_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive requests array"); - if (NULL == (recv_msgs = HDmalloc((size_t)num_subfiles_owned * 3 * sizeof(*recv_msgs)))) + if (NULL == (recv_msgs = malloc((size_t)num_subfiles_owned * 3 * sizeof(*recv_msgs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate message array"); /* @@ -186,8 +186,8 @@ H5FD__subfiling__truncate_sub_files(hid_t context_id, int64_t logical_file_eof, H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); done: - HDfree(recv_msgs); - HDfree(recv_reqs); + free(recv_msgs); + free(recv_reqs); H5_SUBFILING_FUNC_LEAVE; } /* H5FD__subfiling__truncate_sub_files() */ @@ -308,11 +308,11 @@ H5FD__subfiling__get_real_eof(hid_t context_id, int64_t *logical_eof_ptr) assert(n_io_concentrators > 0); assert(num_subfiles >= n_io_concentrators); - if (NULL == (sf_eofs = HDmalloc((size_t)num_subfiles * sizeof(int64_t)))) + if (NULL == (sf_eofs = malloc((size_t)num_subfiles * sizeof(int64_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile EOFs array"); - if (NULL == (recv_reqs = HDmalloc((size_t)num_subfiles * sizeof(*recv_reqs)))) + if (NULL == (recv_reqs = malloc((size_t)num_subfiles * sizeof(*recv_reqs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive requests array"); - if (NULL == (recv_msg = HDmalloc((size_t)num_subfiles * sizeof(msg)))) + if (NULL == (recv_msg = malloc((size_t)num_subfiles * sizeof(msg)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate message array"); for (int i = 0; i < num_subfiles; i++) { @@ -405,9 +405,9 @@ done: } } - HDfree(recv_msg); - HDfree(recv_reqs); - HDfree(sf_eofs); + free(recv_msg); + free(recv_reqs); + free(sf_eofs); H5_SUBFILING_FUNC_LEAVE; } /* H5FD__subfiling__get_real_eof() */ diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index 59a193e..20d617d 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -468,7 +468,7 @@ H5Pset_fapl_subfiling(hid_t fapl_id, const H5FD_subfiling_config_t *vfd_config) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (vfd_config == NULL) { - if (NULL == (subfiling_conf = HDcalloc(1, sizeof(*subfiling_conf)))) + if (NULL == (subfiling_conf = calloc(1, sizeof(*subfiling_conf)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfiling VFD configuration"); subfiling_conf->ioc_fapl_id = H5I_INVALID_HID; @@ -516,7 +516,7 @@ done: if (subfiling_conf) { if (subfiling_conf->ioc_fapl_id >= 0 && H5I_dec_ref(subfiling_conf->ioc_fapl_id) < 0) H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't close IOC FAPL"); - HDfree(subfiling_conf); + free(subfiling_conf); } H5_SUBFILING_FUNC_LEAVE_API; @@ -902,7 +902,7 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char * /* Decode config file prefix string */ if (tmpu64 > 0) { if (!sf_context->config_file_prefix) { - if (NULL == (sf_context->config_file_prefix = HDmalloc(tmpu64))) + if (NULL == (sf_context->config_file_prefix = malloc(tmpu64))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for config file prefix string"); @@ -1346,7 +1346,7 @@ H5FD__subfiling_close_int(H5FD_subfiling_t *file_ptr) file_ptr->fail_to_encode = FALSE; done: - HDfree(file_ptr->file_path); + free(file_ptr->file_path); file_ptr->file_path = NULL; H5MM_free(file_ptr->file_dir); @@ -1675,14 +1675,14 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i * to contain the translation of the I/O request into a collection of * I/O requests. */ - if (NULL == (source_data_offset = - HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) + if (NULL == + (source_data_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate source data offset I/O vector"); - if (NULL == (sf_data_size = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) + if (NULL == (sf_data_size = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile data size I/O vector"); - if (NULL == (sf_offset = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) + if (NULL == (sf_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile offset I/O vector"); @@ -1713,16 +1713,16 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i H5_CHECKED_ASSIGN(vector_len, uint32_t, num_subfiles_used, int); /* Allocate I/O vectors */ - if (NULL == (io_types = HDmalloc(vector_len * sizeof(*io_types)))) + if (NULL == (io_types = malloc(vector_len * sizeof(*io_types)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O types vector"); - if (NULL == (io_addrs = HDmalloc(vector_len * sizeof(*io_addrs)))) + if (NULL == (io_addrs = malloc(vector_len * sizeof(*io_addrs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O addresses vector"); - if (NULL == (io_sizes = HDmalloc(vector_len * sizeof(*io_sizes)))) + if (NULL == (io_sizes = malloc(vector_len * sizeof(*io_sizes)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O sizes vector"); - if (NULL == (io_bufs = HDmalloc(vector_len * sizeof(*io_bufs)))) + if (NULL == (io_bufs = malloc(vector_len * sizeof(*io_bufs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O buffers vector"); @@ -1774,13 +1774,13 @@ H5FD__subfiling_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_i file_ptr->op = OP_READ; done: - HDfree(io_bufs); - HDfree(io_sizes); - HDfree(io_addrs); - HDfree(io_types); - HDfree(sf_offset); - HDfree(sf_data_size); - HDfree(source_data_offset); + free(io_bufs); + free(io_sizes); + free(io_addrs); + free(io_types); + free(sf_offset); + free(sf_data_size); + free(source_data_offset); if (ret_value < 0) { /* Reset last file I/O information */ @@ -1918,14 +1918,14 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ * to contain the translation of the I/O request into a collection of * I/O requests. */ - if (NULL == (source_data_offset = - HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) + if (NULL == + (source_data_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*source_data_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate source data offset I/O vector"); - if (NULL == (sf_data_size = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) + if (NULL == (sf_data_size = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_data_size)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile data size I/O vector"); - if (NULL == (sf_offset = HDcalloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) + if (NULL == (sf_offset = calloc(1, (size_t)num_subfiles * max_depth * sizeof(*sf_offset)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile offset I/O vector"); @@ -1956,16 +1956,16 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ H5_CHECKED_ASSIGN(vector_len, uint32_t, num_subfiles_used, int); /* Allocate I/O vectors */ - if (NULL == (io_types = HDmalloc(vector_len * sizeof(*io_types)))) + if (NULL == (io_types = malloc(vector_len * sizeof(*io_types)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O types vector"); - if (NULL == (io_addrs = HDmalloc(vector_len * sizeof(*io_addrs)))) + if (NULL == (io_addrs = malloc(vector_len * sizeof(*io_addrs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O addresses vector"); - if (NULL == (io_sizes = HDmalloc(vector_len * sizeof(*io_sizes)))) + if (NULL == (io_sizes = malloc(vector_len * sizeof(*io_sizes)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O sizes vector"); - if (NULL == (io_bufs = HDmalloc(vector_len * sizeof(*io_bufs)))) + if (NULL == (io_bufs = malloc(vector_len * sizeof(*io_bufs)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O buffers vector"); @@ -2031,13 +2031,13 @@ H5FD__subfiling_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_ file_ptr->local_eof = file_ptr->pos; done: - HDfree(io_bufs); - HDfree(io_sizes); - HDfree(io_addrs); - HDfree(io_types); - HDfree(sf_offset); - HDfree(sf_data_size); - HDfree(source_data_offset); + free(io_bufs); + free(io_sizes); + free(io_addrs); + free(io_types); + free(sf_offset); + free(sf_data_size); + free(source_data_offset); if (ret_value < 0) { /* Reset last file I/O information */ diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 6302b08..3ef9344 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -154,7 +154,7 @@ H5_get_subfiling_object(int64_t object_id) /* Create subfiling context cache if it doesn't exist */ if (!sf_context_cache) { - if (NULL == (sf_context_cache = HDcalloc(DEFAULT_CONTEXT_CACHE_SIZE, sizeof(*sf_context_cache)))) + if (NULL == (sf_context_cache = calloc(DEFAULT_CONTEXT_CACHE_SIZE, sizeof(*sf_context_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling context cache"); sf_context_cache_size = DEFAULT_CONTEXT_CACHE_SIZE; @@ -171,7 +171,7 @@ H5_get_subfiling_object(int64_t object_id) new_size = (sf_context_cache_size * 3) / 2; - if (NULL == (tmp_realloc = HDrealloc(sf_context_cache, new_size * sizeof(*sf_context_cache)))) + if (NULL == (tmp_realloc = realloc(sf_context_cache, new_size * sizeof(*sf_context_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling context cache"); @@ -201,7 +201,7 @@ H5_get_subfiling_object(int64_t object_id) assert(!sf_context_cache[sf_context_cache_num_entries]); /* Allocate a new subfiling context object */ - if (NULL == (ret_value = HDcalloc(1, sizeof(subfiling_context_t)))) + if (NULL == (ret_value = calloc(1, sizeof(subfiling_context_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate subfiling context object"); @@ -211,8 +211,7 @@ H5_get_subfiling_object(int64_t object_id) else if (obj_type == SF_TOPOLOGY) { /* Create subfiling topology cache if it doesn't exist */ if (!sf_topology_cache) { - if (NULL == - (sf_topology_cache = HDcalloc(DEFAULT_TOPOLOGY_CACHE_SIZE, sizeof(*sf_topology_cache)))) + if (NULL == (sf_topology_cache = calloc(DEFAULT_TOPOLOGY_CACHE_SIZE, sizeof(*sf_topology_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling topology cache"); sf_topology_cache_size = DEFAULT_TOPOLOGY_CACHE_SIZE; @@ -229,7 +228,7 @@ H5_get_subfiling_object(int64_t object_id) new_size = (sf_topology_cache_size * 3) / 2; - if (NULL == (tmp_realloc = HDrealloc(sf_topology_cache, new_size * sizeof(*sf_topology_cache)))) + if (NULL == (tmp_realloc = realloc(sf_topology_cache, new_size * sizeof(*sf_topology_cache)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate space for subfiling topology cache"); @@ -259,7 +258,7 @@ H5_get_subfiling_object(int64_t object_id) assert(!sf_topology_cache[sf_topology_cache_num_entries]); /* Allocate a new subfiling topology object */ - if (NULL == (ret_value = HDmalloc(sizeof(sf_topology_t)))) + if (NULL == (ret_value = malloc(sizeof(sf_topology_t)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't allocate subfiling topology object"); @@ -400,16 +399,16 @@ H5_free_subfiling_object_int(subfiling_context_t *sf_context) sf_context->sf_group_size = -1; sf_context->sf_group_rank = -1; - HDfree(sf_context->subfile_prefix); + free(sf_context->subfile_prefix); sf_context->subfile_prefix = NULL; - HDfree(sf_context->config_file_prefix); + free(sf_context->config_file_prefix); sf_context->config_file_prefix = NULL; - HDfree(sf_context->h5_filename); + free(sf_context->h5_filename); sf_context->h5_filename = NULL; - HDfree(sf_context->sf_fids); + free(sf_context->sf_fids); sf_context->sf_fids = NULL; /* @@ -420,7 +419,7 @@ H5_free_subfiling_object_int(subfiling_context_t *sf_context) */ sf_context->topology = NULL; - HDfree(sf_context); + free(sf_context); H5_SUBFILING_FUNC_LEAVE; } @@ -456,25 +455,25 @@ H5_free_subfiling_topology(sf_topology_t *topology) topology->n_io_concentrators = 0; if (topology->app_layout) { - HDfree(topology->app_layout->layout); + free(topology->app_layout->layout); topology->app_layout->layout = NULL; - HDfree(topology->app_layout->node_ranks); + free(topology->app_layout->node_ranks); topology->app_layout->node_ranks = NULL; - HDfree(topology->app_layout); + free(topology->app_layout); } topology->app_layout = NULL; - HDfree(topology->io_concentrators); + free(topology->io_concentrators); topology->io_concentrators = NULL; if (!mpi_finalized) if (H5_mpi_comm_free(&topology->app_comm) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free MPI communicator"); - HDfree(topology); + free(topology); H5_SUBFILING_FUNC_LEAVE; } @@ -1337,7 +1336,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) assert(MPI_COMM_NULL != comm); assert(MPI_COMM_NULL != node_comm); - if (NULL == (app_layout = HDcalloc(1, sizeof(*app_layout)))) + if (NULL == (app_layout = calloc(1, sizeof(*app_layout)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout structure"); @@ -1350,7 +1349,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(node_comm, &app_layout->node_local_size))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Comm_size failed", mpi_code); - if (NULL == (app_layout->layout = HDmalloc((size_t)app_layout->world_size * sizeof(*app_layout->layout)))) + if (NULL == (app_layout->layout = malloc((size_t)app_layout->world_size * sizeof(*app_layout->layout)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout array"); @@ -1373,7 +1372,7 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) assert(app_layout->node_count > 0); if (NULL == - (app_layout->node_ranks = HDmalloc((size_t)app_layout->node_count * sizeof(*app_layout->node_ranks)))) + (app_layout->node_ranks = malloc((size_t)app_layout->node_count * sizeof(*app_layout->node_ranks)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate application layout node rank array"); @@ -1393,9 +1392,9 @@ init_app_layout(sf_topology_t *app_topology, MPI_Comm comm, MPI_Comm node_comm) done: if (ret_value < 0) { if (app_layout) { - HDfree(app_layout->layout); - HDfree(app_layout->node_ranks); - HDfree(app_layout); + free(app_layout->layout); + free(app_layout->node_ranks); + free(app_layout); } } @@ -1493,7 +1492,7 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com /* Allocate a partial layout info array to aggregate into from node-local ranks */ if (node_local_rank == 0) { if (NULL == - (layout_info_partial = HDmalloc((size_t)node_local_size * sizeof(*layout_info_partial)))) + (layout_info_partial = malloc((size_t)node_local_size * sizeof(*layout_info_partial)))) /* Push error, but participate in gather operation */ H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate layout info array"); @@ -1508,10 +1507,10 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com if (node_local_rank == 0) { int send_size = 4 * node_local_size; - if (NULL == (recv_counts = HDmalloc((size_t)aggr_comm_size * sizeof(*recv_counts)))) + if (NULL == (recv_counts = malloc((size_t)aggr_comm_size * sizeof(*recv_counts)))) H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive counts array"); - if (NULL == (recv_displs = HDmalloc((size_t)aggr_comm_size * sizeof(*recv_displs)))) + if (NULL == (recv_displs = malloc((size_t)aggr_comm_size * sizeof(*recv_displs)))) H5_SUBFILING_DONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate receive displacements array"); @@ -1528,8 +1527,8 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com recv_counts, recv_displs, MPI_INT, aggr_comm))) H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Allgatherv failed", mpi_code); - HDfree(recv_displs); - HDfree(recv_counts); + free(recv_displs); + free(recv_counts); recv_displs = NULL; recv_counts = NULL; } @@ -1545,9 +1544,9 @@ gather_topology_info(app_layout_t *app_layout, MPI_Comm comm, MPI_Comm intra_com } done: - HDfree(recv_displs); - HDfree(recv_counts); - HDfree(layout_info_partial); + free(recv_displs); + free(recv_counts); + free(layout_info_partial); if (H5_mpi_comm_free(&aggr_comm) < 0) H5_SUBFILING_DONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "can't free MPI communicator"); @@ -1623,8 +1622,8 @@ identify_ioc_ranks(sf_topology_t *app_topology, int rank_stride) max_iocs = app_topology->n_io_concentrators; - if (NULL == (app_topology->io_concentrators = - HDmalloc((size_t)max_iocs * sizeof(*app_topology->io_concentrators)))) + if (NULL == + (app_topology->io_concentrators = malloc((size_t)max_iocs * sizeof(*app_topology->io_concentrators)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate array of I/O concentrator ranks"); @@ -1719,7 +1718,7 @@ identify_ioc_ranks(sf_topology_t *app_topology, int rank_stride) done: if (ret_value < 0) { if (app_topology) - HDfree(app_topology->io_concentrators); + free(app_topology->io_concentrators); } H5_SUBFILING_FUNC_LEAVE; @@ -1833,7 +1832,7 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam sf_context->sf_num_fids++; if (NULL == - (sf_context->sf_fids = HDmalloc((size_t)sf_context->sf_num_fids * sizeof(*sf_context->sf_fids)))) + (sf_context->sf_fids = malloc((size_t)sf_context->sf_num_fids * sizeof(*sf_context->sf_fids)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate subfile IDs array"); for (int i = 0; i < sf_context->sf_num_fids; i++) @@ -1996,8 +1995,7 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in herr_t ret_value = SUCCEED; if (!sf_open_file_map) { - if (NULL == - (sf_open_file_map = HDmalloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) + if (NULL == (sf_open_file_map = malloc((size_t)DEFAULT_FILE_MAP_ENTRIES * sizeof(*sf_open_file_map)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate open file mapping"); sf_file_map_size = DEFAULT_FILE_MAP_ENTRIES; @@ -2026,8 +2024,8 @@ record_fid_to_subfile(uint64_t file_id, int64_t subfile_context_id, int *next_in if (index == sf_file_map_size) { void *tmp_realloc; - if (NULL == (tmp_realloc = HDrealloc(sf_open_file_map, - ((size_t)(sf_file_map_size * 2) * sizeof(*sf_open_file_map))))) + if (NULL == (tmp_realloc = realloc(sf_open_file_map, + ((size_t)(sf_file_map_size * 2) * sizeof(*sf_open_file_map))))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't reallocate open file mapping"); @@ -2158,7 +2156,7 @@ ioc_open_files(int64_t file_context_id, int file_acc_flags) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't get HDF5 file dirname"); } - if (NULL == (filepath = HDmalloc(PATH_MAX))) + if (NULL == (filepath = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfile filename"); @@ -2231,7 +2229,7 @@ done: H5MM_free(base); H5MM_free(subfile_dir); - HDfree(filepath); + free(filepath); H5_SUBFILING_FUNC_LEAVE; } @@ -2280,7 +2278,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c if (*subfile_dir == '\0') subfile_dir = "."; - if (NULL == (config_filename = HDmalloc(PATH_MAX))) + if (NULL == (config_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); @@ -2311,7 +2309,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't create/truncate subfiling configuration file"); - if (NULL == (line_buf = HDmalloc(PATH_MAX))) + if (NULL == (line_buf = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate buffer for writing to subfiling configuration file"); @@ -2364,8 +2362,8 @@ done: "couldn't close subfiling configuration file"); } - HDfree(line_buf); - HDfree(config_filename); + free(line_buf); + free(config_filename); H5_SUBFILING_FUNC_LEAVE; } @@ -2408,7 +2406,7 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil if (*config_dir == '\0') config_dir = "."; - if (NULL == (config_filename = HDmalloc(PATH_MAX))) + if (NULL == (config_filename = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for subfiling configuration filename"); @@ -2441,7 +2439,7 @@ done: "couldn't close subfiling configuration file"); } - HDfree(config_filename); + free(config_filename); H5_SUBFILING_FUNC_LEAVE; } @@ -2480,7 +2478,7 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "couldn't seek to beginning of subfiling configuration file"); - if (NULL == (config_buf = HDmalloc((size_t)config_file_len + 1))) + if (NULL == (config_buf = malloc((size_t)config_file_len + 1))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for reading from subfiling configuration file"); @@ -2526,7 +2524,7 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 } done: - HDfree(config_buf); + free(config_buf); H5_SUBFILING_FUNC_LEAVE; } @@ -2540,7 +2538,7 @@ done: * between MPI ranks. * * The resolved filepath returned through `resolved_filepath` - * must be freed by the caller with HDfree. + * must be freed by the caller with free. * * Return Non-negative on success/Negative on failure * @@ -2577,12 +2575,12 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat /* If filepath is just the filename, set up path using CWD */ if (!HDstrcmp(file_dirname, ".")) { - if (NULL == (resolved_path = HDmalloc(PATH_MAX))) + if (NULL == (resolved_path = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for filepath"); if (H5_basename(filepath, &file_basename) < 0) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file basename"); - if (NULL == (cwd = HDmalloc(PATH_MAX))) + if (NULL == (cwd = malloc(PATH_MAX))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for CWD"); @@ -2624,7 +2622,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't resolve filepath"); if (mpi_rank != 0) { - if (NULL == (resolved_path = HDmalloc(path_len))) + if (NULL == (resolved_path = malloc(path_len))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate file name buffer"); } @@ -2639,7 +2637,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat *resolved_filepath = resolved_path; done: - HDfree(cwd); + free(cwd); H5MM_free(file_basename); H5MM_free(file_dirname); @@ -2654,7 +2652,7 @@ done: H5_SUBFILING_MPI_DONE_ERROR(FAIL, "MPI_Bcast failed", mpi_code); } - HDfree(resolved_path); + free(resolved_path); } H5_SUBFILING_FUNC_LEAVE; @@ -3084,7 +3082,7 @@ H5_subfiling_terminate(void) sf_context_cache_size = 0; sf_context_cache_num_entries = 0; - HDfree(sf_context_cache); + free(sf_context_cache); sf_context_cache = NULL; } if (sf_topology_cache) { @@ -3098,13 +3096,13 @@ H5_subfiling_terminate(void) sf_topology_cache_size = 0; sf_topology_cache_num_entries = 0; - HDfree(sf_topology_cache); + free(sf_topology_cache); sf_topology_cache = NULL; } /* Clean up the file ID to context object mapping */ sf_file_map_size = 0; - HDfree(sf_open_file_map); + free(sf_open_file_map); sf_open_file_map = NULL; done: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 4edcb1c..3978771 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -931,7 +931,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ } /* end if */ done: - HDfree(comment.s); + free(comment.s); /* Indicate that this callback didn't take ownership of the group * * location for the object */ @@ -77,7 +77,7 @@ H5MM_malloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - ret_value = HDmalloc(size); + ret_value = malloc(size); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_malloc() */ @@ -106,7 +106,7 @@ H5MM_calloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - ret_value = HDcalloc(1, size); + ret_value = calloc(1, size); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_calloc() */ @@ -141,7 +141,7 @@ H5MM_realloc(void *mem, size_t size) /* Not defined in the standard, return NULL */ ret_value = NULL; else { - ret_value = HDrealloc(mem, size); + ret_value = realloc(mem, size); /* Some platforms do not return NULL if size is zero. */ if (0 == size) @@ -255,7 +255,7 @@ H5MM_xfree(void *mem) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDfree(mem); + free(mem); FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree() */ diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 130a83e..84656ad 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -26,7 +26,7 @@ /* Private headers needed by this file */ #include "H5private.h" -#define H5MM_free(Z) HDfree(Z) +#define H5MM_free(Z) free(Z) /* * Library prototypes... diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 52c70b9..4f09192 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -119,9 +119,9 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i fprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); - HDfree(timestrs.user); - HDfree(timestrs.system); - HDfree(timestrs.elapsed); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); } #endif diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 450d61c..9218fdd 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -541,7 +541,7 @@ H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc "application memory allocation routine failed for VL data") } /* end if */ else /* Default to system malloc */ - if (NULL == (vl.p = HDmalloc(len))) + if (NULL == (vl.p = malloc(len))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data") /* Copy the data into the newly allocated buffer */ @@ -734,7 +734,7 @@ H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc "application memory allocation routine failed for VL data") } /* end if */ else /* Default to system malloc */ - if (NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size))) + if (NULL == (t = (char *)malloc((seq_len + 1) * base_size))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data") /* 'write' the string into the buffer, with memcpy() */ @@ -1074,7 +1074,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info if (free_func != NULL) (*free_func)(vl->p, free_info); else - HDfree(vl->p); + free(vl->p); } /* end if */ } else if (dt->shared->u.vlen.type == H5T_VLEN_STRING) { @@ -1082,7 +1082,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info if (free_func != NULL) (*free_func)(*(char **)elem, free_info); else - HDfree(*(char **)elem); + free(*(char **)elem); } else { assert(0 && "Invalid VL type"); @@ -180,9 +180,9 @@ H5Z_term_package(void) H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); next: - HDfree(timestrs.user); - HDfree(timestrs.system); - HDfree(timestrs.elapsed); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); } /* end for */ } /* end for */ } /* end if */ diff --git a/src/H5private.h b/src/H5private.h index ed9e270..676fb22 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -638,9 +638,6 @@ typedef off_t h5_stat_size_t; #ifndef HDatoll #define HDatoll(S) atoll(S) #endif -#ifndef HDcalloc -#define HDcalloc(N, Z) calloc(N, Z) -#endif #ifndef HDceil #define HDceil(X) ceil(X) #endif @@ -751,9 +748,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfread #define HDfread(M, Z, N, F) fread(M, Z, N, F) #endif -#ifndef HDfree -#define HDfree(M) free(M) -#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) #endif @@ -901,9 +895,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDlstat #define HDlstat(S, B) lstat(S, B) #endif -#ifndef HDmalloc -#define HDmalloc(Z) malloc(Z) -#endif #ifndef HDmemcmp #define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) #endif @@ -1001,9 +992,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDreaddir #define HDreaddir(D) readdir(D) #endif -#ifndef HDrealloc -#define HDrealloc(M, Z) realloc(M, Z) -#endif #ifndef HDrealpath #define HDrealpath(F1, F2) realpath(F1, F2) #endif diff --git a/src/H5system.c b/src/H5system.c index 7a76723..46fea7a 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -75,7 +75,7 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) char *buf; /* buffer to receive formatted string */ size_t bufsz; /* size of buffer to allocate */ - for (bufsz = 32; (buf = HDmalloc(bufsz)) != NULL;) { + for (bufsz = 32; (buf = malloc(bufsz)) != NULL;) { int ret; va_list ap; @@ -86,7 +86,7 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) *bufp = buf; return ret; } - HDfree(buf); + free(buf); if (ret < 0) return ret; bufsz = (size_t)ret + 1; @@ -1301,7 +1301,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct H5_optind++; sp = 1; - HDfree(arg); + free(arg); } else { char *cp; /* pointer into current token */ diff --git a/src/H5timer.c b/src/H5timer.c index 7690c57..89e4fd2 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -617,7 +617,7 @@ H5_timer_get_time_string(double seconds) } /* end if */ /* Allocate */ - if (NULL == (s = (char *)HDcalloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) + if (NULL == (s = (char *)calloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) return NULL; /* Do we need a format string? Some people might like a certain |