diff --git a/src/io.c b/src/io.c index e31e28c82..70c6721be 100644 --- a/src/io.c +++ b/src/io.c @@ -2374,10 +2374,7 @@ _dispatch_operation_perform(dispatch_operation_t op) } op->buf = _aligned_malloc(op->buf_siz, siInfo.dwPageSize); #else - err = posix_memalign(&op->buf, (size_t)PAGE_SIZE, op->buf_siz); - if (err != 0) { - goto error; - } + op->buf = aligned_alloc((size_t)PAGE_SIZE, op->buf_siz) #endif _dispatch_op_debug("buffer allocated", op); } else if (op->direction == DOP_DIR_WRITE) { diff --git a/tests/dispatch_io.c b/tests/dispatch_io.c index fbfcb6055..a5a1cea67 100644 --- a/tests/dispatch_io.c +++ b/tests/dispatch_io.c @@ -398,7 +398,7 @@ test_async_read(char *path, size_t size, int option, dispatch_queue_t queue, buffer = _aligned_malloc(size, si.dwPageSize); #else size_t pagesize = (size_t)sysconf(_SC_PAGESIZE); - posix_memalign((void **)&buffer, pagesize, size); + buffer = aligned_alloc(pagesize, size); #endif ssize_t r = dispatch_test_fd_read(fd, buffer, size); if (r == -1) { diff --git a/tests/dispatch_read2.c b/tests/dispatch_read2.c index 0e4535961..401fb4f62 100644 --- a/tests/dispatch_read2.c +++ b/tests/dispatch_read2.c @@ -91,7 +91,7 @@ dispatch_read2(dispatch_fd_t fd, buffer = _aligned_malloc(bufsiz, pagesize); #else size_t pagesize = (size_t)sysconf(_SC_PAGESIZE); - posix_memalign((void **)&buffer, pagesize, bufsiz); + buffer = aligned_alloc(pagesize, bufsiz); #endif ssize_t actual = dispatch_test_fd_read(fd, buffer, bufsiz); if (actual == -1) {