Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> --- src/mesa/main/imports.c | 76 ------------------------------------------------- src/mesa/main/imports.h | 6 ---- 2 files changed, 82 deletions(-)
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 5961587..3937a02 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -64,82 +64,6 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); #endif -/**********************************************************************/ -/** \name Memory */ -/*@{*/ - -/** - * Allocate aligned memory. - * - * \param bytes number of bytes to allocate. - * \param alignment alignment (must be greater than zero). - * - * Allocates extra memory to accommodate rounding up the address for - * alignment and to record the real malloc address. - * - * \sa _mesa_align_free(). - */ -void * -_mesa_align_malloc(size_t bytes, unsigned long alignment) -{ -#if defined(HAVE_POSIX_MEMALIGN) - void *mem; - int err = posix_memalign(& mem, alignment, bytes); - if (err) - return NULL; - return mem; -#elif defined(_WIN32) && defined(_MSC_VER) - return _aligned_malloc(bytes, alignment); -#else - uintptr_t ptr, buf; - - assert( alignment > 0 ); - - ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *)); - if (!ptr) - return NULL; - - buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1); - *(uintptr_t *)(buf - sizeof(void *)) = ptr; - -#ifdef DEBUG - /* mark the non-aligned area */ - while ( ptr < buf - sizeof(void *) ) { - *(unsigned long *)ptr = 0xcdcdcdcd; - ptr += sizeof(unsigned long); - } -#endif - - return (void *) buf; -#endif /* defined(HAVE_POSIX_MEMALIGN) */ -} - -/** - * Free memory which was allocated with either _mesa_align_malloc(). - * \param ptr pointer to the memory to be freed. - * The actual address to free is stored in the word immediately before the - * address the client sees. - * Note that it is legal to pass NULL pointer to this function and will be - * handled accordingly. - */ -void -_mesa_align_free(void *ptr) -{ -#if defined(HAVE_POSIX_MEMALIGN) - free(ptr); -#elif defined(_WIN32) && defined(_MSC_VER) - _aligned_free(ptr); -#else - if (ptr) { - void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); - void *realAddr = *cubbyHole; - free(realAddr); - } -#endif /* defined(HAVE_POSIX_MEMALIGN) */ -} - -/*@}*/ - /**********************************************************************/ /** \name Math */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a3767fd..db3a91d 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -361,12 +361,6 @@ _mesa_little_endian(void) */ extern void * -_mesa_align_malloc( size_t bytes, unsigned long alignment ); - -extern void -_mesa_align_free( void *ptr ); - -extern void * _mesa_exec_malloc( GLuint size ); extern void -- 2.1.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev