From 605cea4af60cfcbe03a54f697de392eec75e5a85 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:03:45 -0700 Subject: Remove HD from HDposix_memalign() (#3196) The posix_memalign call is only used in the direct VFD, which can only be built if posix_memalign() is available. --- src/H5FDdirect.c | 14 +++++++------- src/H5private.h | 3 --- test/vfd.c | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index d2896e6..7275bb5 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -550,11 +550,11 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad * than the one where the program is running. */ /* NOTE: Use HDmalloc and HDfree here to ensure compatibility with - * HDposix_memalign. + * posix_memalign. */ buf1 = HDmalloc(sizeof(int)); - if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + if (posix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "posix_memalign failed") if (o_flags & O_CREAT) { if (HDwrite(file->fd, buf1, sizeof(int)) < 0) { @@ -944,8 +944,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U if (alloc_size > _cbsize) alloc_size = _cbsize; assert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + if (posix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed") /* look for the aligned position for reading the data */ assert(!(((addr / _fbsize) * _fbsize) % _fbsize)); @@ -1125,8 +1125,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ alloc_size = _cbsize; assert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + if (posix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed") /* look for the right position for reading or writing the data */ if (HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0) diff --git a/src/H5private.h b/src/H5private.h index c08da40..ed9e270 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -904,9 +904,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) #endif -#ifndef HDposix_memalign -#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z) -#endif #ifndef HDmemcmp #define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) #endif diff --git a/test/vfd.c b/test/vfd.c index e28a7c1..2b11db6 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -788,10 +788,10 @@ test_direct(void) /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including * memory address, size of data, and file address. */ - if (0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if (0 != posix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; points = proto_points; - if (0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if (0 != posix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; check = proto_check; -- cgit v0.12