Skip to content

Commit 542b7f3

Browse files
authored
Merge pull request #826 from apple/eng/PR-123808864
Switching back _dispatch_operation_perform to use posix_memalign from aligned_malloc
2 parents 2d21ba5 + e173eda commit 542b7f3

File tree

4 files changed

+1
-12
lines changed

4 files changed

+1
-12
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Android)
191191
endif()
192192

193193
check_function_exists(_pthread_workqueue_init HAVE__PTHREAD_WORKQUEUE_INIT)
194-
check_function_exists(aligned_alloc HAVE_ALIGNED_ALLOC)
195194
check_function_exists(getprogname HAVE_GETPROGNAME)
196195
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
197196
check_function_exists(mach_approximate_time HAVE_MACH_APPROXIMATE_TIME)

src/io.c

-2
Original file line numberDiff line numberDiff line change
@@ -2373,8 +2373,6 @@ _dispatch_operation_perform(dispatch_operation_t op)
23732373
bQueried = true;
23742374
}
23752375
op->buf = _aligned_malloc(op->buf_siz, siInfo.dwPageSize);
2376-
#elif defined(HAVE_ALIGNED_ALLOC)
2377-
op->buf = aligned_alloc((size_t)PAGE_SIZE, op->buf_siz);
23782376
#else
23792377
err = posix_memalign(&op->buf, (size_t)PAGE_SIZE, op->buf_siz);
23802378
if (err != 0) {

tests/dispatch_io.c

-4
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,7 @@ test_async_read(char *path, size_t size, int option, dispatch_queue_t queue,
398398
buffer = _aligned_malloc(size, si.dwPageSize);
399399
#else
400400
size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
401-
#if defined(HAVE_ALIGNED_ALLOC)
402-
buffer = aligned_alloc(pagesize, size);
403-
#else
404401
posix_memalign((void **)&buffer, pagesize, size);
405-
#endif
406402
#endif
407403
ssize_t r = dispatch_test_fd_read(fd, buffer, size);
408404
if (r == -1) {

tests/dispatch_read2.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ dispatch_read2(dispatch_fd_t fd,
9191
buffer = _aligned_malloc(bufsiz, pagesize);
9292
#else
9393
size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
94-
#if defined(HAVE_ALIGNED_ALLOC)
95-
buffer = aligned_alloc(pagesize, bufsiz);
96-
#else
9794
posix_memalign((void **)&buffer, pagesize, bufsiz);
98-
#endif
9995
#endif
10096
ssize_t actual = dispatch_test_fd_read(fd, buffer, bufsiz);
10197
if (actual == -1) {
@@ -154,7 +150,7 @@ test_read(void)
154150
test_stop();
155151
}
156152
#else
157-
// investigate what the impact of lack of file cache disabling has
153+
// investigate what the impact of lack of file cache disabling has
158154
// for this test
159155
#endif
160156
size_t size = (size_t)dispatch_test_fd_lseek(fd, 0, SEEK_END);

0 commit comments

Comments
 (0)