summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-28 20:03:45 (GMT)
committerGitHub <noreply@github.com>2023-06-28 20:03:45 (GMT)
commit605cea4af60cfcbe03a54f697de392eec75e5a85 (patch)
tree20b6c58c39883d0ab983f99685d5de05b5cbe753
parent96d89bcae7b47402b97e87787a007d558ddcb66b (diff)
downloadhdf5-605cea4af60cfcbe03a54f697de392eec75e5a85.zip
hdf5-605cea4af60cfcbe03a54f697de392eec75e5a85.tar.gz
hdf5-605cea4af60cfcbe03a54f697de392eec75e5a85.tar.bz2
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.
-rw-r--r--src/H5FDdirect.c14
-rw-r--r--src/H5private.h3
-rw-r--r--test/vfd.c4
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(&copy_buf, _boundary, alloc_size) != 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
+ if (posix_memalign(&copy_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(&copy_buf, _boundary, alloc_size) != 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
+ if (posix_memalign(&copy_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;