Skip to content
Snippets Groups Projects
Commit 4dcc6a1b authored by deuce's avatar deuce
Browse files

Remove 16-bit cruft.

parent 1aa52dba
No related branches found
No related tags found
No related merge requests found
......@@ -44,41 +44,11 @@
#include "lzh.h"
/****************************************************************************/
/* Memory allocation 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 */
/****************************************************************************/
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
#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 REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#endif
#define REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
......@@ -597,40 +567,40 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
#ifdef LZH_DYNAMIC_BUF
if((lzh.text_buf=(uchar *)MALLOC(LZH_N + LZH_F - 1))==NULL)
if((lzh.text_buf=(uchar *)malloc(LZH_N + LZH_F - 1))==NULL)
return(-1);
if((lzh.freq=(unsigned short*)MALLOC((LZH_T + 1)*sizeof(unsigned short)))==NULL) {
FREE(lzh.text_buf);
if((lzh.freq=(unsigned short*)malloc((LZH_T + 1)*sizeof(unsigned short)))==NULL) {
free(lzh.text_buf);
return(-1); }
if((lzh.prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.freq);
if((lzh.prnt=(short *)malloc((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.freq);
return(-1); }
if((lzh.son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
if((lzh.son=(short *)malloc((LZH_T + 1) * sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
return(-1); }
if((lzh.lson=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
if((lzh.lson=(short *)malloc((LZH_N + 1)*sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
return(-1); }
if((lzh.rson=(short *)MALLOC((LZH_N + 257)*sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
FREE(lzh.lson);
if((lzh.rson=(short *)malloc((LZH_N + 257)*sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
free(lzh.lson);
return(-1); }
if((lzh.dad=(short *)MALLOC((LZH_N + 1)*sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
FREE(lzh.lson);
FREE(lzh.rson);
if((lzh.dad=(short *)malloc((LZH_N + 1)*sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
free(lzh.lson);
free(lzh.rson);
return(-1); }
#endif
......@@ -639,13 +609,13 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
outlen=sizeof(inlen);
if(!inlen) {
#ifdef LZH_DYNAMIC_BUF
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
FREE(lzh.lson);
FREE(lzh.rson);
FREE(lzh.dad);
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
free(lzh.lson);
free(lzh.rson);
free(lzh.dad);
#endif
return(outlen); }
lzh_start_huff(&lzh);
......@@ -704,13 +674,13 @@ long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf)
*/
#ifdef LZH_DYNAMIC_BUF
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
FREE(lzh.lson);
FREE(lzh.rson);
FREE(lzh.dad);
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
free(lzh.lson);
free(lzh.rson);
free(lzh.dad);
#endif
return(outlen);
......@@ -728,20 +698,20 @@ long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
memset(&lzh,0,sizeof(lzh));
#ifdef LZH_DYNAMIC_BUF
if((lzh.text_buf=(uchar *)MALLOC((LZH_N + LZH_F - 1)*2))==NULL)
if((lzh.text_buf=(uchar *)malloc((LZH_N + LZH_F - 1)*2))==NULL)
return(-1);
if((lzh.freq=(unsigned short *)MALLOC((LZH_T + 1)*sizeof(unsigned short)))
if((lzh.freq=(unsigned short *)malloc((LZH_T + 1)*sizeof(unsigned short)))
==NULL) {
FREE(lzh.text_buf);
free(lzh.text_buf);
return(-1); }
if((lzh.prnt=(short *)MALLOC((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.freq);
if((lzh.prnt=(short *)malloc((LZH_T + LZH_N_CHAR)*sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.freq);
return(-1); }
if((lzh.son=(short *)MALLOC((LZH_T + 1) * sizeof(short)))==NULL) {
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
if((lzh.son=(short *)malloc((LZH_T + 1) * sizeof(short)))==NULL) {
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
return(-1); }
#endif
......@@ -751,10 +721,10 @@ long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
incnt+=sizeof(textsize);
if (textsize == 0) {
#ifdef LZH_DYNAMIC_BUF
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
#endif
return(textsize); }
lzh_start_huff(&lzh);
......@@ -799,10 +769,10 @@ long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf)
***/
#ifdef LZH_DYNAMIC_BUF
FREE(lzh.text_buf);
FREE(lzh.prnt);
FREE(lzh.freq);
FREE(lzh.son);
free(lzh.text_buf);
free(lzh.prnt);
free(lzh.freq);
free(lzh.son);
#endif
return(count);
......
......@@ -75,45 +75,13 @@
#endif
#endif
/****************************************************************************/
/* Memory allocation 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 */
/****************************************************************************/
#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
#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 */
......
......@@ -900,7 +900,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
}
l=sizeof(msghdr_t);
if(msg->hdr.total_dfields && (msg->dfield
=(dfield_t *)MALLOC(sizeof(dfield_t)*msg->hdr.total_dfields))==NULL) {
=(dfield_t *)malloc(sizeof(dfield_t)*msg->hdr.total_dfields))==NULL) {
smb_freemsgmem(msg);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for %d data fields"
......@@ -928,7 +928,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
}
while(l<(ulong)msg->hdr.length) {
i=msg->total_hfields;
if((vpp=(void* *)REALLOC(msg->hfield_dat,sizeof(void* )*(i+1)))==NULL) {
if((vpp=(void* *)realloc(msg->hfield_dat,sizeof(void* )*(i+1)))==NULL) {
smb_freemsgmem(msg);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"realloc failure of %d bytes for header field data"
......@@ -936,7 +936,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
return(SMB_ERR_MEM);
}
msg->hfield_dat=vpp;
if((vp=(hfield_t *)REALLOC(msg->hfield,sizeof(hfield_t)*(i+1)))==NULL) {
if((vp=(hfield_t *)realloc(msg->hfield,sizeof(hfield_t)*(i+1)))==NULL) {
smb_freemsgmem(msg);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"realloc failure of %d bytes for header fields"
......@@ -952,7 +952,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
return(SMB_ERR_READ);
}
l+=sizeof(hfield_t);
if((msg->hfield_dat[i]=(char*)MALLOC(msg->hfield[i].length+1))
if((msg->hfield_dat[i]=(char*)malloc(msg->hfield[i].length+1))
==NULL) { /* Allocate 1 extra for ASCIIZ terminator */
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for header field %d"
......@@ -997,16 +997,16 @@ void SMBCALL smb_freemsghdrmem(smbmsg_t* msg)
for(i=0;i<msg->total_hfields;i++)
if(msg->hfield_dat[i]) {
FREE(msg->hfield_dat[i]);
free(msg->hfield_dat[i]);
msg->hfield_dat[i]=NULL;
}
msg->total_hfields=0;
if(msg->hfield) {
FREE(msg->hfield);
free(msg->hfield);
msg->hfield=NULL;
}
if(msg->hfield_dat) {
FREE(msg->hfield_dat);
free(msg->hfield_dat);
msg->hfield_dat=NULL;
}
clear_convenience_ptrs(msg); /* don't leave pointers to freed memory */
......@@ -1018,7 +1018,7 @@ void SMBCALL smb_freemsghdrmem(smbmsg_t* msg)
void SMBCALL smb_freemsgmem(smbmsg_t* msg)
{
if(msg->dfield) {
FREE(msg->dfield);
free(msg->dfield);
msg->dfield=NULL;
}
msg->hdr.total_dfields=0;
......@@ -1036,7 +1036,7 @@ int SMBCALL smb_copymsgmem(smb_t* smb, smbmsg_t* msg, smbmsg_t* srcmsg)
/* data field types/lengths */
if(msg->hdr.total_dfields>0) {
if((msg->dfield=(dfield_t *)MALLOC(msg->hdr.total_dfields*sizeof(dfield_t)))==NULL) {
if((msg->dfield=(dfield_t *)malloc(msg->hdr.total_dfields*sizeof(dfield_t)))==NULL) {
if(smb!=NULL)
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for %d data fields"
......@@ -1048,7 +1048,7 @@ int SMBCALL smb_copymsgmem(smb_t* smb, smbmsg_t* msg, smbmsg_t* srcmsg)
/* header field types/lengths */
if(msg->total_hfields>0) {
if((msg->hfield=(hfield_t *)MALLOC(msg->total_hfields*sizeof(hfield_t)))==NULL) {
if((msg->hfield=(hfield_t *)malloc(msg->total_hfields*sizeof(hfield_t)))==NULL) {
if(smb!=NULL)
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for %d header fields"
......@@ -1058,7 +1058,7 @@ int SMBCALL smb_copymsgmem(smb_t* smb, smbmsg_t* msg, smbmsg_t* srcmsg)
memcpy(msg->hfield,srcmsg->hfield,msg->total_hfields*sizeof(hfield_t));
/* header field data */
if((msg->hfield_dat=(void**)MALLOC(msg->total_hfields*sizeof(void*)))==NULL) {
if((msg->hfield_dat=(void**)malloc(msg->total_hfields*sizeof(void*)))==NULL) {
if(smb!=NULL)
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for %d header fields"
......@@ -1067,7 +1067,7 @@ int SMBCALL smb_copymsgmem(smb_t* smb, smbmsg_t* msg, smbmsg_t* srcmsg)
}
for(i=0;i<msg->total_hfields;i++) {
if((msg->hfield_dat[i]=(void*)MALLOC(msg->hfield[i].length+1))==NULL) {
if((msg->hfield_dat[i]=(void*)malloc(msg->hfield[i].length+1))==NULL) {
if(smb!=NULL)
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %d bytes for header field #%d"
......@@ -1110,11 +1110,11 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
return(SMB_ERR_HDR_LEN);
i=msg->total_hfields;
if((hp=(hfield_t *)REALLOC(msg->hfield,sizeof(hfield_t)*(i+1)))==NULL)
if((hp=(hfield_t *)realloc(msg->hfield,sizeof(hfield_t)*(i+1)))==NULL)
return(SMB_ERR_MEM);
msg->hfield=hp;
if((vpp=(void* *)REALLOC(msg->hfield_dat,sizeof(void* )*(i+1)))==NULL)
if((vpp=(void* *)realloc(msg->hfield_dat,sizeof(void* )*(i+1)))==NULL)
return(SMB_ERR_MEM);
msg->hfield_dat=vpp;
......@@ -1122,7 +1122,7 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
msg->hfield[i].type=type;
msg->hfield[i].length=length;
if(length) {
if((msg->hfield_dat[i]=(void* )MALLOC(length+1))==NULL)
if((msg->hfield_dat[i]=(void* )malloc(length+1))==NULL)
return(SMB_ERR_MEM); /* Allocate 1 extra for ASCIIZ terminator */
memset(msg->hfield_dat[i],0,length+1);
memcpy(msg->hfield_dat[i],data,length);
......@@ -1205,7 +1205,7 @@ int SMBCALL smb_hfield_append(smbmsg_t* msg, ushort type, size_t length, void* d
if(smb_getmsghdrlen(msg)+length>SMB_MAX_HDR_LEN)
return(SMB_ERR_HDR_LEN);
if((p=(BYTE*)REALLOC(msg->hfield_dat[i],msg->hfield[i].length+length+1))==NULL)
if((p=(BYTE*)realloc(msg->hfield_dat[i],msg->hfield[i].length+length+1))==NULL)
return(SMB_ERR_MEM); /* Allocate 1 extra for ASCIIZ terminator */
msg->hfield_dat[i]=p;
......@@ -1254,7 +1254,7 @@ int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, ulong length)
int i,j;
i=msg->hdr.total_dfields;
if((dp=(dfield_t *)REALLOC(msg->dfield,sizeof(dfield_t)*(i+1)))==NULL)
if((dp=(dfield_t *)realloc(msg->dfield,sizeof(dfield_t)*(i+1)))==NULL)
return(SMB_ERR_MEM);
msg->dfield=dp;
......@@ -1314,7 +1314,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
}
if(length!=0) {
if((buf=(ulong*)MALLOC(length))==NULL) {
if((buf=(ulong*)malloc(length))==NULL) {
close(file);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"malloc failure of %ld bytes"
......@@ -1324,7 +1324,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
if(read(file,buf,length)!=length) {
close(file);
FREE(buf);
free(buf);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"%d '%s' reading %ld bytes"
,get_errno(),STRERROR(get_errno()),length);
......@@ -1336,7 +1336,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
break;
if(l<length/sizeof(long)) { /* Dupe CRC found */
close(file);
FREE(buf);
free(buf);
safe_snprintf(smb->last_error,sizeof(smb->last_error)
,"duplicate message text CRC detected");
return(SMB_DUPE_MSG);
......@@ -1348,7 +1348,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
lseek(file,0L,SEEK_SET);
write(file,buf+(length-newlen),newlen);
}
FREE(buf);
free(buf);
}
wr=write(file,&crc,sizeof(crc)); /* Write to the end */
close(file);
......
......@@ -397,7 +397,7 @@ if(mode&WIN_T2B)
else if(mode&WIN_BOT)
top=api->scrn_len-height-3-top;
if(mode&WIN_SAV && api->savdepth==api->savnum) {
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
if((sav[api->savnum].buf=(char *)malloc((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2);
return(-1); }
......@@ -415,8 +415,8 @@ else if(mode&WIN_SAV
|| sav[api->savnum].bot!=SCRN_TOP+top+height)) { /* dimensions have changed */
puttext(sav[api->savnum].left,sav[api->savnum].top,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf); /* put original window back */
FREE(sav[api->savnum].buf);
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
free(sav[api->savnum].buf);
if((sav[api->savnum].buf=(char *)malloc((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2);
return(-1); }
......@@ -678,7 +678,7 @@ while(1) {
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
showmouse();
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--; }
return(*cur); }
else if(r.w.cx/8>=SCRN_LEFT+left+3
......@@ -710,7 +710,7 @@ hitesc:
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
showmouse();
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--; }
return(-1); }
}
......@@ -1134,7 +1134,7 @@ hitesc:
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
showmouse();
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--; }
return(*cur);
case ESC:
......@@ -1155,7 +1155,7 @@ hitesc:
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
showmouse();
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--; }
return(-1); } } }
else
......@@ -1678,15 +1678,15 @@ void help()
_setcursortype(_NOCURSOR);
if((savscrn=(char *)MALLOC(80*25*2))==NULL) {
if((savscrn=(char *)malloc(80*25*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes\r\n"
,__LINE__,80*25*2);
_setcursortype(cursor);
return; }
if((buf=(char *)MALLOC(76*21*2))==NULL) {
if((buf=(char *)malloc(76*21*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes\r\n"
,__LINE__,76*21*2);
FREE(savscrn);
free(savscrn);
_setcursortype(cursor);
return; }
hidemouse();
......@@ -1826,8 +1826,8 @@ void help()
hidemouse();
puttext(1,1,80,25,savscrn);
showmouse();
FREE(savscrn);
FREE(buf);
free(savscrn);
free(buf);
_setcursortype(cursor);
}
......@@ -69,43 +69,13 @@
#define strnicmp strncasecmp
#endif
/****************************************************************************/
/* 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 */
/****************************************************************************/
#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
#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 REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#endif
#define REALLOC realloc
#define LMALLOC malloc
#define MALLOC malloc
#define LFREE free
#define FREE free
#if !defined(FREE_AND_NULL)
#define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; }
#define FREE_AND_NULL(x) if(x!=NULL) { free(x); x=NULL; }
#endif
#if !defined(MAX_PATH) /* maximum path length */
......
......@@ -260,17 +260,17 @@ int uifcini32(uifcapi_t* uifcapi)
}
blk_scrn_len=api->scrn_width*api->scrn_len*2;
if((blk_scrn=(char *)MALLOC(blk_scrn_len))==NULL) {
if((blk_scrn=(char *)malloc(blk_scrn_len))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,blk_scrn_len);
return(-1);
}
if((tmp_buffer=(uchar *)MALLOC(blk_scrn_len))==NULL) {
if((tmp_buffer=(uchar *)malloc(blk_scrn_len))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,blk_scrn_len);
return(-1);
}
if((tmp_buffer2=(uchar *)MALLOC(blk_scrn_len))==NULL) {
if((tmp_buffer2=(uchar *)malloc(blk_scrn_len))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,blk_scrn_len);
return(-1);
......@@ -597,7 +597,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(!is_redraw) {
if(mode&WIN_SAV && api->savdepth==api->savnum) {
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
if((sav[api->savnum].buf=(char *)malloc((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2);
free(title);
......@@ -619,8 +619,8 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
|| sav[api->savnum].bot!=s_top+top+height)) { /* dimensions have changed */
puttext(sav[api->savnum].left,sav[api->savnum].top,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf); /* put original window back */
FREE(sav[api->savnum].buf);
if((sav[api->savnum].buf=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
free(sav[api->savnum].buf);
if((sav[api->savnum].buf=(char *)malloc((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2);
free(title);
......@@ -919,7 +919,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
if(mode&WIN_ACT) {
uifc_mouse_disable();
if((win=(char *)MALLOC((width+3)*(height+2)*2))==NULL) {
if((win=(char *)malloc((width+3)*(height+2)*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes."
,__LINE__,(width+3)*(height+2)*2);
return(-1);
......@@ -1481,7 +1481,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
puttext(sav[api->savnum].left,sav[api->savnum].top
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--;
}
if(mode&WIN_XTR && (*cur)==opts-1)
......@@ -1502,7 +1502,7 @@ int ulist(int mode, int left, int top, int width, int *cur, int *bar
puttext(sav[api->savnum].left,sav[api->savnum].top
,sav[api->savnum].right,sav[api->savnum].bot
,sav[api->savnum].buf);
FREE(sav[api->savnum].buf);
free(sav[api->savnum].buf);
api->savdepth--;
}
return(-1);
......@@ -2423,7 +2423,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
if(lines < height-2-pad-pad)
lines=height-2-pad-pad;
if((textbuf=(char *)MALLOC((width-2-pad-pad)*lines*2))==NULL) {
if((textbuf=(char *)malloc((width-2-pad-pad)*lines*2))==NULL) {
cprintf("UIFC line %d: error allocating %u bytes\r\n"
,__LINE__,(width-2-pad-pad)*lines*2);
_setcursortype(cursor);
......@@ -2538,7 +2538,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
}
if(is_redraw) /* Force redraw of menu also. */
reset_dynamic();
FREE(textbuf);
free(textbuf);
_setcursortype(cursor);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment