diff --git a/config.h.meson b/config.h.meson index fd0bfcaf9..291b668cd 100644 --- a/config.h.meson +++ b/config.h.meson @@ -689,9 +689,6 @@ /* Define to the version of this package. */ #mesondefine PACKAGE_VERSION -/* define if posix_memalign() can allocate any size */ -#mesondefine POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS - /* The size of `char', as computed by sizeof. */ #mesondefine SIZEOF_CHAR diff --git a/config.h.win32.in b/config.h.win32.in index 14ac11d39..af4157259 100644 --- a/config.h.win32.in +++ b/config.h.win32.in @@ -704,9 +704,6 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@.@GLIB_MICRO_VERSION@" -/* define if posix_memalign() can allocate any size */ -/* #undef POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS */ - /* The size of `char', as computed by sizeof. */ #define SIZEOF_CHAR 1 diff --git a/configure.ac b/configure.ac index be48c9a19..55471d34d 100644 --- a/configure.ac +++ b/configure.ac @@ -1335,48 +1335,6 @@ if test x$glib_cv_langinfo_abaltmon = xyes; then fi AC_LANG_RESTORE -dnl **************************************** -dnl *** posix_memalign *** -dnl **************************************** -AC_MSG_CHECKING(for a compliant posix_memalign() implementation) -AC_CACHE_VAL(glib_cv_compliant_posix_memalign,[ - glib_cv_compliant_posix_memalign=0 - if test "$ac_cv_func_posix_memalign" = "yes" ; then - AC_TRY_RUN([ - #define _XOPEN_SOURCE 600 - #include /* posix_memalign() should be defined here */ - /* some systems break if #include used */ - static void test_memalign (size_t boundary, size_t size) { - void *mem = 0; - if (posix_memalign (&mem, boundary, size) != 0 || !mem) - exit (1); - else - free (mem); - } - int main() { - test_memalign ( 128, 128 - 2 * sizeof (void*)); - test_memalign ( 256, 256 - 2 * sizeof (void*)); - test_memalign ( 512, 512 - 2 * sizeof (void*)); - test_memalign ( 1024, 1024 - 2 * sizeof (void*)); - test_memalign ( 2048, 2048 - 2 * sizeof (void*)); - test_memalign ( 4096, 4096 - 2 * sizeof (void*)); - test_memalign ( 8192, 8192 - 2 * sizeof (void*)); - test_memalign (16384, 16384 - 2 * sizeof (void*)); - test_memalign (32768, 32768 - 2 * sizeof (void*)); - exit (0); /* success */ - } - ], - [glib_cv_compliant_posix_memalign=1], [], [:]) - : - fi - ]) -AS_IF([test "$glib_cv_compliant_posix_memalign" = "1"], [ - AC_MSG_RESULT(yes) - AC_DEFINE(POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS, 1, [define if posix_memalign() can allocate any size]) -], [ - AC_MSG_RESULT(no) -]) - dnl **************************************** dnl *** strlcpy/strlcat *** diff --git a/glib/gslice.c b/glib/gslice.c index 48e4c5a33..d1b1fc639 100644 --- a/glib/gslice.c +++ b/glib/gslice.c @@ -19,11 +19,7 @@ #include "config.h" #include "glibconfig.h" -#if defined HAVE_POSIX_MEMALIGN && defined POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS -# define HAVE_COMPLIANT_POSIX_MEMALIGN 1 -#endif - -#if defined(HAVE_COMPLIANT_POSIX_MEMALIGN) && !defined(_XOPEN_SOURCE) +#if defined(HAVE_POSIX_MEMALIGN) && !defined(_XOPEN_SOURCE) #define _XOPEN_SOURCE 600 /* posix_memalign() */ #endif #include /* posix_memalign() */ @@ -416,7 +412,7 @@ g_slice_init_nomessage (void) mem_assert ((sys_page_size & (sys_page_size - 1)) == 0); slice_config_init (&allocator->config); allocator->min_page_size = sys_page_size; -#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN +#if HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN /* allow allocation of pages up to 8KB (with 8KB alignment). * this is useful because many medium to large sized structures * fit less than 8 times (see [4]) into 4KB pages. @@ -1394,13 +1390,12 @@ slab_allocator_free_chunk (gsize chunk_size, /* from config.h: * define HAVE_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works, - * define HAVE_COMPLIANT_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works for sizes != 2^n, * define HAVE_MEMALIGN 1 // if free(memalign(3)) works, * define HAVE_VALLOC 1 // if free(valloc(3)) works, or * if none is provided, we implement malloc(3)-based alloc-only page alignment */ -#if !(HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC) +#if !(HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC) static GTrashStack *compat_valloc_trash = NULL; #endif @@ -1410,7 +1405,7 @@ allocator_memalign (gsize alignment, { gpointer aligned_memory = NULL; gint err = ENOMEM; -#if HAVE_COMPLIANT_POSIX_MEMALIGN +#if HAVE_POSIX_MEMALIGN err = posix_memalign (&aligned_memory, alignment, memsize); #elif HAVE_MEMALIGN errno = 0; @@ -1454,7 +1449,7 @@ static void allocator_memfree (gsize memsize, gpointer mem) { -#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC +#if HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC free (mem); #else mem_assert (memsize <= sys_page_size);