Skip to content
Snippets Groups Projects
Commit 303d0db9 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Eliminate old macro-wrappers for malloc/free/realloc

Artifacts from the 16-bit DOS days where we needed the large or huge
"memory model" to allocate > 64KB of memory.
parent 60bde349
No related branches found
No related tags found
No related merge requests found
...@@ -58,15 +58,6 @@ ...@@ -58,15 +58,6 @@
#endif #endif
#endif #endif
#define HUGE16
#define FAR16
#define REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#define SDT_BLOCK_LEN 256 /* Size of data blocks */ #define SDT_BLOCK_LEN 256 /* Size of data blocks */
#define SHD_BLOCK_LEN 256 /* Size of header blocks */ #define SHD_BLOCK_LEN 256 /* Size of header blocks */
......
...@@ -492,54 +492,12 @@ typedef struct { ...@@ -492,54 +492,12 @@ typedef struct {
#define ZERO_VAR(var) memset(&(var),0,sizeof(var)) #define ZERO_VAR(var) memset(&(var),0,sizeof(var))
#define ZERO_ARRAY(array) memset(array,0,sizeof(array)) #define ZERO_ARRAY(array) memset(array,0,sizeof(array))
/****************************************************************************/
/* MALLOC/FREE Macros for various compilers and environments */
/* MALLOC is used for allocations of 64k or less */
/* FREE is used to free buffers allocated with MALLOC */
/* LMALLOC is used for allocations of possibly larger than 64k */
/* LFREE is used to free buffers allocated with LMALLOC */
/* REALLOC is used to re-size a previously MALLOCed or LMALLOCed buffer */
/* FAR16 is used to create a far (32-bit) pointer in 16-bit compilers */
/* HUGE16 is used to create a huge (32-bit) pointer in 16-bit compilers */
/****************************************************************************/
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
#define HUGE16 huge
#define FAR16 far
#if defined(__TURBOC__)
#define REALLOC(x,y) farrealloc(x,y)
#define LMALLOC(x) farmalloc(x)
#define MALLOC(x) farmalloc(x)
#define LFREE(x) farfree(x)
#define FREE(x) farfree(x)
#elif defined(__WATCOMC__)
#define REALLOC realloc
#define LMALLOC(x) halloc(x,1) /* far heap, but slow */
#define MALLOC malloc /* far heap, but 64k max */
#define LFREE hfree
#define FREE free
#else /* Other 16-bit Compiler */
#define REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#endif
#else /* 32-bit Compiler or Small Memory Model */
#define HUGE16
#define FAR16
#define REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#endif
/********************************/ /********************************/
/* Handy Pointer-freeing Macros */ /* Handy Pointer-freeing Macros */
/********************************/ /********************************/
#define FREE_AND_NULL(x) do { \ #define FREE_AND_NULL(x) do { \
if((x)!=NULL) { \ if((x)!=NULL) { \
FREE(x); \ free(x); \
(x)=NULL; \ (x)=NULL; \
} \ } \
} while(0) } while(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment