Remove posix_memalign workaround, now we have it in libc.

In ifdef's no longer used following the libc update, so no bump.
From Brad (maintainer).
This commit is contained in:
sthen 2010-06-03 01:05:03 +00:00
parent 6353ef21bf
commit d5d0293b63

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-modules_access_v4l2_c,v 1.1 2010/05/09 00:16:26 sthen Exp $
$OpenBSD: patch-modules_access_v4l2_c,v 1.2 2010/06/03 01:05:03 sthen Exp $
--- modules/access/v4l2.c.orig Wed May 5 18:50:08 2010
+++ modules/access/v4l2.c Wed May 5 19:09:36 2010
@@ -49,7 +49,13 @@
@ -16,73 +16,3 @@ $OpenBSD: patch-modules_access_v4l2_c,v 1.1 2010/05/09 00:16:26 sthen Exp $
#include <poll.h>
@@ -492,6 +498,9 @@ struct buffer_t
{
void * start;
size_t length;
+#if !defined(HAVE_POSIX_MEMALIGN) && !defined(HAVE_MEMALIGN)
+ void * free;
+#endif
};
struct demux_sys_t
@@ -1038,7 +1047,12 @@ static void DemuxClose( vlc_object_t *p_this )
switch( p_sys->io )
{
case IO_METHOD_READ:
- free( p_sys->p_buffers[0].start );
+#if !defined (HAVE_POSIX_MEMALIGN) && !defined (HAVE_MEMALIGN)
+ if (p_sys->p_buffers[0].free)
+ free( p_sys->p_buffers[0].free );
+ else
+#endif
+ free( p_sys->p_buffers[0].start );
break;
case IO_METHOD_MMAP:
@@ -1054,7 +1068,12 @@ static void DemuxClose( vlc_object_t *p_this )
case IO_METHOD_USERPTR:
for( i = 0; i < p_sys->i_nbuffers; ++i )
{
- free( p_sys->p_buffers[i].start );
+#if !defined (HAVE_POSIX_MEMALIGN) && !defined (HAVE_MEMALIGN)
+ if (p_sys->p_buffers[0].free)
+ free( p_sys->p_buffers[i].free );
+ else
+#endif
+ free( p_sys->p_buffers[i].start );
}
break;
@@ -1600,10 +1619,31 @@ static int InitUserP( vlc_object_t *p_demux, demux_sys
for( p_sys->i_nbuffers = 0; p_sys->i_nbuffers < 4; ++p_sys->i_nbuffers )
{
+#ifdef HAVE_POSIX_MEMALIGN
p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
if( posix_memalign( &p_sys->p_buffers[p_sys->i_nbuffers].start,
/* boundary */ i_page_size, i_buffer_size ) )
goto open_failed;
+#elif defined (HAVE_MEMALIGN)
+ p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
+ p_sys->p_buffers[p_sys->i_nbuffers].start =
+ memalign ( /* boundary */ i_page_size, i_buffer_size );
+ if( p_sys->p_buffers[p_sys->i_nbuffers].start == NULL )
+ goto open_failed;
+#else
+ unsigned char *ptr;
+ size_t align = i_page_size - 1;
+
+ p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
+ ptr = malloc (i_buffer_size + align);
+ if ( ptr == NULL )
+ goto open_failed;
+
+ p_sys->p_buffers[p_sys->i_nbuffers].free = ptr;
+ ptr += align;
+ p_sys->p_buffers[p_sys->i_nbuffers].start =
+ (void *)(((uintptr_t)ptr) & ~align);
+#endif
}
return VLC_SUCCESS;