diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 1 | ||||
-rw-r--r-- | Alc/alcRing.c | 1 | ||||
-rw-r--r-- | Alc/bformatdec.c | 1 | ||||
-rw-r--r-- | Alc/helpers.c | 50 |
4 files changed, 3 insertions, 50 deletions
@@ -44,6 +44,7 @@ #include "compat.h" #include "threads.h" #include "alstring.h" +#include "almalloc.h" #include "backends/base.h" diff --git a/Alc/alcRing.c b/Alc/alcRing.c index e9a40a12..05db7bc3 100644 --- a/Alc/alcRing.c +++ b/Alc/alcRing.c @@ -25,6 +25,7 @@ #include "alMain.h" #include "threads.h" +#include "almalloc.h" #include "compat.h" diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c index 6dd5ce9a..e4c6da49 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.c @@ -6,6 +6,7 @@ #include "alu.h" #include "threads.h" +#include "almalloc.h" typedef struct BandSplitter { diff --git a/Alc/helpers.c b/Alc/helpers.c index f596c0d9..c8983c11 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -243,56 +243,6 @@ void FillCPUCaps(ALuint capfilter) } -void *al_malloc(size_t alignment, size_t size) -{ -#if defined(HAVE_ALIGNED_ALLOC) - size = (size+(alignment-1))&~(alignment-1); - return aligned_alloc(alignment, size); -#elif defined(HAVE_POSIX_MEMALIGN) - void *ret; - if(posix_memalign(&ret, alignment, size) == 0) - return ret; - return NULL; -#elif defined(HAVE__ALIGNED_MALLOC) - return _aligned_malloc(size, alignment); -#else - char *ret = malloc(size+alignment); - if(ret != NULL) - { - *(ret++) = 0x00; - while(((ptrdiff_t)ret&(alignment-1)) != 0) - *(ret++) = 0x55; - } - return ret; -#endif -} - -void *al_calloc(size_t alignment, size_t size) -{ - void *ret = al_malloc(alignment, size); - if(ret) memset(ret, 0, size); - return ret; -} - -void al_free(void *ptr) -{ -#if defined(HAVE_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN) - free(ptr); -#elif defined(HAVE__ALIGNED_MALLOC) - _aligned_free(ptr); -#else - if(ptr != NULL) - { - char *finder = ptr; - do { - --finder; - } while(*finder == 0x55); - free(finder); - } -#endif -} - - void SetMixerFPUMode(FPUCtl *ctl) { #ifdef HAVE_FENV_H |