changeset 2774:039568c6947d

memalign detection cleanup
author pl
date Fri, 09 Nov 2001 02:02:58 +0000
parents 0e5fbba190e9
children 8e3875816f6d
files configure libvo/vo_vesa.c
diffstat 2 files changed, 16 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Fri Nov 09 00:41:26 2001 +0000
+++ b/configure	Fri Nov 09 02:02:58 2001 +0000
@@ -1153,19 +1153,18 @@
 # ---
 # check availability of some header files
 
-# check for malloc.h and memalign() in it
+# check for malloc.h
 cat > $TMPC << EOF
 #include <malloc.h>
 int main( void ) { return 0; }
 EOF
-_memalign_def=
-_memalign=no
 _malloc_h=no
-if cc_check ; then
- _malloc_h=yes
- # check for memalign - atmos
- # should this be restricted to x86, or customized for cpu types (opt for cacheline sizes)?
- cat > $TMPC << EOF
+cc_check && _malloc_h=yes
+
+
+# check for memalign() in malloc.h
+# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ?
+cat > $TMPC << EOF
 #include <malloc.h>
 int main ( void ) {
 char *string = NULL;
@@ -1173,14 +1172,9 @@
 return 0;
 }
 EOF
- if cc_check ; then
-  _memalign_def='/* #define memalign(a,b) malloc(b) */'
-  _memalign=yes
- else
-  _memalign_def='#define memalign(a,b) malloc(b)'
-  _memalign=no
- fi
-fi
+_memalign=no
+cc_check && _memalign=yes
+
 
 # check for alloca.h
 cat > $TMPC << EOF
@@ -2172,7 +2166,7 @@
 else
   _have_malloc_h='#undef  HAVE_MALLOC_H'
 fi
-# malloc.h useless in FreeBSD
+# malloc.h emits a warning in FreeBSD
 freebsd && _have_malloc_h='#undef  HAVE_MALLOC_H'
 
 if test "$_memalign" = yes ; then
@@ -2627,9 +2621,11 @@
 /* Define this if your system has the "malloc.h" header file */
 $_have_malloc_h
 
-/* memalign is mapped to malloc here, if unsupported */
-$_memalign_def
+/* memalign is mapped to malloc if unsupported */
 $_have_memalign
+#ifndef HAVE_MEMALIGN
+# define memalign(a,b) malloc(b)
+#endif
 
 /* Define this if your system has the "alloca.h" header file */
 $_have_alloca_h
--- a/libvo/vo_vesa.c	Fri Nov 09 00:41:26 2001 +0000
+++ b/libvo/vo_vesa.c	Fri Nov 09 02:02:58 2001 +0000
@@ -25,7 +25,7 @@
 #include "video_out.h"
 #include "video_out_internal.h"
 
-#ifdef HAVE_MEMALIGN
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 
@@ -791,11 +791,7 @@
 		  cpy_blk_fnc = __vbeCopyBlock;
 		  if(yuv_fmt || rgb2rgb_fnc)
 		  {
-#ifdef HAVE_MEMALIGN
 		    if(!(dga_buffer = memalign(64,video_mode_info.XResolution*video_mode_info.YResolution*video_mode_info.BitsPerPixel)))
-#else
-		    if(!(dga_buffer = malloc(video_mode_info.XResolution*video_mode_info.YResolution*video_mode_info.BitsPerPixel)))
-#endif
 		    {
 		      printf("vo_vesa: Can't allocate temporary buffer\n");
 		      return -1;