From 7b289d1a98181d8537dd0e38f604faae7858049f Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Mon, 16 Sep 2024 11:36:30 -0700 Subject: [PATCH] Get rid of config check for 16 byte aligned malloc. All current implementations do this. --- config/ax_check_16aligned_malloc.m4 | 66 ----------------------------- configure.ac | 2 - src/alloc/base.c | 4 -- 3 files changed, 72 deletions(-) delete mode 100644 config/ax_check_16aligned_malloc.m4 diff --git a/config/ax_check_16aligned_malloc.m4 b/config/ax_check_16aligned_malloc.m4 deleted file mode 100644 index 8cd54c222..000000000 --- a/config/ax_check_16aligned_malloc.m4 +++ /dev/null @@ -1,66 +0,0 @@ -dnl based on http://autoconf-archive.cryp.to/ax_check_page_aligned_malloc.html -dnl but different (obviously) -AC_DEFUN([AX_CHECK_16ALIGNED_MALLOC], -[AC_CACHE_CHECK([if mallocs guarantee 16-byte alignment], - [ax_cv_func_malloc_16aligned], - [AC_TRY_RUN([ -#include -#include -#if HAVE_UNISTD_H -# include -#endif - -int main() -{ - int i; - - for (i=0; i<100; i++) - if ((unsigned long)malloc(17) & (15)) - exit (1); - for (i=0; i<100; i++) - if ((unsigned long)malloc(1) & (15)) - exit (1); - exit (0); -} - ], - [ax_cv_func_malloc_16aligned=yes], - [ax_cv_func_malloc_16aligned=no], - [ax_cv_func_malloc_16aligned=no]) - ]) -if test "$ax_cv_func_malloc_16aligned" = yes ; then - AC_DEFINE([HAVE_16ALIGNED_MALLOC], [1], - [Define if `malloc'ing more than 16 bytes always returns a 16-byte-aligned address (common practice on MacOS X).]) -fi -]) -AC_DEFUN([AX_CHECK_16ALIGNED_CALLOC], -[AC_CACHE_CHECK([if callocs guarantee 16-byte alignment], - [ax_cv_func_calloc_16aligned], - [AC_TRY_RUN([ -#include -#include -#if HAVE_UNISTD_H -# include -#endif - -int main() -{ - int i; - - for (i=0; i<100; i++) - if ((unsigned long)calloc(1,17) & (15)) - exit (1); - for (i=0; i<100; i++) - if ((unsigned long)calloc(1,1) & (15)) - exit (1); - exit (0); -} - ], - [ax_cv_func_calloc_16aligned=yes], - [ax_cv_func_calloc_16aligned=no], - [ax_cv_func_calloc_16aligned=no]) - ]) -if test "$ax_cv_func_calloc_16aligned" = yes ; then - AC_DEFINE([HAVE_16ALIGNED_CALLOC], [1], - [Define if `calloc'ing more than 16 bytes always returns a 16-byte-aligned address (common practice on MacOS X).]) -fi -]) diff --git a/configure.ac b/configure.ac index 1f8c6415a..8e9746833 100644 --- a/configure.ac +++ b/configure.ac @@ -670,8 +670,6 @@ QTHREAD_CHECK_QSORT AC_CHECK_DECLS([MADV_ACCESS_LWP],[],[],[[#include #include ]]) AX_CHECK_PAGE_ALIGNED_MALLOC -AX_CHECK_16ALIGNED_MALLOC -AX_CHECK_16ALIGNED_CALLOC QTHREAD_CHECK_WORKING_VALLOC QTHREAD_CHECK_ASSERT([],[AC_MSG_ERROR([assert() does not seem to work])]) diff --git a/src/alloc/base.c b/src/alloc/base.c index 090daa2e3..81f808912 100644 --- a/src/alloc/base.c +++ b/src/alloc/base.c @@ -39,12 +39,10 @@ void *qt_internal_aligned_alloc(size_t alloc_size, uint_fast16_t alignment) { assert(alloc_size > 0); switch (alignment) { case 0: ret = MALLOC(alloc_size); break; -#if defined(HAVE_16ALIGNED_MALLOC) case 16: case 8: case 4: case 2: ret = MALLOC(alloc_size); break; -#endif default: #if defined(HAVE_WORKING_VALLOC) if (alignment == pagesize) { @@ -80,12 +78,10 @@ void qt_internal_aligned_free(void *ptr, uint_fast16_t alignment) { assert(ptr); switch (alignment) { case 0: qt_free(ptr); break; -#if defined(HAVE_16ALIGNED_MALLOC) case 16: case 8: case 4: case 2: qt_free(ptr); break; -#endif default: #if defined(HAVE_WORKING_VALLOC) || defined(HAVE_PAGE_ALIGNED_MALLOC) if (alignment == pagesize) {