mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-24 07:50:59 +00:00
Add preprocessor token NO_ALIGNED_MALLOC which disables compilation with aligned memory allocation. Useful for old versions of Windows and Mac OS X.
git-svn-id: https://svn.eduke32.com/eduke32@5636 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
db535acbf8
commit
dce9e3c91e
1 changed files with 15 additions and 6 deletions
|
@ -932,6 +932,7 @@ FORCE_INLINE void *xrealloc(void * const ptr, const bsize_t size)
|
||||||
return newptr;
|
return newptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined NO_ALIGNED_MALLOC
|
||||||
FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -946,7 +947,7 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
||||||
if (ptr == NULL) handle_memerr();
|
if (ptr == NULL) handle_memerr();
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -983,21 +984,29 @@ FORCE_INLINE void *xaligned_malloc(const bsize_t alignment, const bsize_t size)
|
||||||
# define Xmalloc(size) (EDUKE32_PRE_XALLLOC, xmalloc(size))
|
# define Xmalloc(size) (EDUKE32_PRE_XALLLOC, xmalloc(size))
|
||||||
# define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLLOC, xcalloc(nmemb, size))
|
# define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLLOC, xcalloc(nmemb, size))
|
||||||
# define Xrealloc(ptr, size) (EDUKE32_PRE_XALLLOC, xrealloc(ptr, size))
|
# define Xrealloc(ptr, size) (EDUKE32_PRE_XALLLOC, xrealloc(ptr, size))
|
||||||
# define Xaligned_alloc(size, alignment) (EDUKE32_PRE_XALLLOC, xaligned_malloc(size, alignment))
|
# if !defined NO_ALIGNED_MALLOC
|
||||||
|
# define Xaligned_alloc(size, alignment) (EDUKE32_PRE_XALLLOC, xaligned_malloc(size, alignment))
|
||||||
|
# else
|
||||||
|
# define Xaligned_alloc(size, alignment) Xmalloc(size)
|
||||||
|
# endif
|
||||||
# define Bexit(status) do { initprintf("exit(%d) at %s:%d in %s()\n", status, __FILE__, __LINE__, EDUKE32_FUNCTION); exit(status); } while (0)
|
# define Bexit(status) do { initprintf("exit(%d) at %s:%d in %s()\n", status, __FILE__, __LINE__, EDUKE32_FUNCTION); exit(status); } while (0)
|
||||||
#else
|
#else
|
||||||
# define Xstrdup xstrdup
|
# define Xstrdup xstrdup
|
||||||
# define Xmalloc xmalloc
|
# define Xmalloc xmalloc
|
||||||
# define Xcalloc xcalloc
|
# define Xcalloc xcalloc
|
||||||
# define Xrealloc xrealloc
|
# define Xrealloc xrealloc
|
||||||
# define Xaligned_alloc xaligned_malloc
|
# if !defined NO_ALIGNED_MALLOC
|
||||||
|
# define Xaligned_alloc xaligned_malloc
|
||||||
|
# else
|
||||||
|
# define Xaligned_alloc(size, alignment) Xmalloc(size)
|
||||||
|
# endif
|
||||||
# define Bexit exit
|
# define Bexit exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined _WIN32 && !defined NO_ALIGNED_MALLOC
|
||||||
# define Baligned_free(ptr) _aligned_free(ptr)
|
# define Baligned_free _aligned_free
|
||||||
#else
|
#else
|
||||||
# define Baligned_free(ptr) Bfree(ptr)
|
# define Baligned_free Bfree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void maybe_grow_buffer(char ** const buffer, int32_t * const buffersize, int32_t const newsize)
|
static inline void maybe_grow_buffer(char ** const buffer, int32_t * const buffersize, int32_t const newsize)
|
||||||
|
|
Loading…
Reference in a new issue