dnl Check for usual libc functions
AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
-AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp uselocale])
+AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r if_nameindex if_nametoindex isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp uselocale])
AC_REPLACE_FUNCS([asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy vasprintf])
AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
VLC_API bool vlc_ureduce( unsigned *, unsigned *, uint64_t, uint64_t, uint64_t );
/* Aligned memory allocator */
-VLC_API void *vlc_memalign(size_t align, size_t size);
#ifdef WIN32
-# define vlc_aligned_free(base) (__mingw_aligned_free(base))
+# include <malloc.h>
+# define vlc_memalign(align, size) (__mingw_aligned_malloc(size, align))
+# define vlc_free(base) (__mingw_aligned_free(base))
#else
-# define vlc_aligned_free(base) free(base)
+static inline void *vlc_memalign(size_t align, size_t size)
+{
+ void *base;
+ if (unlikely(posix_memalign(&base, align, size)))
+ base = NULL;
+ return base;
+}
+# define vlc_free(base) free(base)
#endif
VLC_API void vlc_tdestroy( void *, void (*)(void *) );
}
void CopyCleanCache(copy_cache_t *cache)
{
- vlc_aligned_free(cache->buffer);
+ vlc_free(cache->buffer);
cache->buffer = NULL;
cache->size = 0;
}
#include <vlc_common.h>
#include <vlc_charset.h>
-#if defined(HAVE_POSIX_MEMALIGN)
-# include <stdlib.h>
-#elif defined(HAVE_MEMALIGN) || defined(HAVE_WIN32)
-# include <malloc.h>
-#endif
-
#include <errno.h>
#undef iconv_t
return b_exact;
}
-
-void *vlc_memalign(size_t align, size_t size)
-{
- void *base;
-#if defined(HAVE_POSIX_MEMALIGN)
- if (unlikely(posix_memalign(&base, align, size)))
- base = NULL;
-#elif defined(HAVE_MEMALIGN)
- base = memalign(align, size);
-#elif defined(HAVE_WIN32)
- base = __mingw_aligned_malloc(size, align);
-#else
-# error Unimplemented!
-#endif
- return base;
-}
xml_ReaderDelete
xml_ReaderReset
vlc_keycode2str
-vlc_memalign
vlc_str2keycode
assert( p_picture->p_release_sys == NULL );
free( p_picture->p_q );
- vlc_aligned_free( p_picture->p_data_orig );
+ vlc_free( p_picture->p_data_orig );
free( p_picture->p_sys );
free( p_picture );
}