pixman: Branch 'master'
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Thu Aug 13 09:48:10 PDT 2009
configure.ac | 8 ++++++++
test/blitters-test.c | 18 ++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
New commits:
commit ce966f4d8e8aa9a4465e2ab28666bae891194a72
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed Aug 12 14:08:58 2009 -0400
Check if we have posix_memalign() in configure.ac. [23260, 23261]
Fall back to malloc() in blitters-test.c if we don't.
diff --git a/configure.ac b/configure.ac
index 6f9f600..e6c5e8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -490,6 +490,14 @@ AC_SUBST(GTK_LIBS)
AC_SUBST(DEP_CFLAGS)
AC_SUBST(DEP_LIBS)
+dnl =====================================
+dnl posix_memalign
+
+AC_CHECK_FUNC(posix_memalign, have_posix_memalign=yes, have_posix_memalign=no)
+if test x$have_posix_memalign = xyes; then
+ AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [Whether we have posix_memalign()])
+fi
+
AC_OUTPUT([pixman-1.pc
pixman-1-uninstalled.pc
Makefile
diff --git a/test/blitters-test.c b/test/blitters-test.c
index 4838e81..23de6c2 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -24,7 +24,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
-#include <malloc.h>
+#include <config.h>
#include "pixman.h"
/* A primitive pseudorandom number generator, taken from POSIX.1-2001 example */
@@ -50,6 +50,20 @@ lcg_rand_n (int max)
return lcg_rand () % max;
}
+static void *
+aligned_malloc (size_t align, size_t size)
+{
+ void *result;
+
+#ifdef HAVE_POSIX_MEMALIGN
+ posix_memalign (&result, align, size);
+#else
+ result = malloc (size);
+#endif
+
+ return result;
+}
+
/*----------------------------------------------------------------------------*\
* CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29.
*
@@ -259,7 +273,7 @@ create_random_image (pixman_format_code_t *allowed_formats,
stride = (stride + 3) & ~3;
/* do the allocation */
- buf = (uint32_t *)memalign (64, stride * height);
+ buf = aligned_malloc (64, stride * height);
/* initialize image with random data */
for (i = 0; i < stride * height; i++)
More information about the xorg-commit
mailing list