diff --git a/xtrn/dpoker/dpoker.c b/xtrn/dpoker/dpoker.c index 6dfd9edc069ab0b7f7420761fce507eea3553ce9..f3609f563e706d6d41591d6070341ecf44958a32 100644 --- a/xtrn/dpoker/dpoker.c +++ b/xtrn/dpoker/dpoker.c @@ -244,7 +244,7 @@ void main(int argc, char **argv) pause(); exit(1);} length=filelength(file); - if ((buf=(char *)MALLOC(length))!=NULL) { + if ((buf=(char *)malloc(length))!=NULL) { read(file,buf,length); } close(file); @@ -256,7 +256,7 @@ void main(int argc, char **argv) if (!stricmp(player_stuff.name,user_name)) time_played+=(player_stuff.time*60); } - FREE(buf); + free(buf); } @@ -314,7 +314,7 @@ void main(int argc, char **argv) bprintf("\r\n\1y\1hList of today's players\1n\r\n"); if((file=nopen("DPOKER.PLR",O_RDONLY))!=-1) { length=filelength(file); - if ((buf=(char *)MALLOC(length))!=NULL) { + if ((buf=(char *)malloc(length))!=NULL) { read(file,buf,length); } close(file); @@ -335,7 +335,7 @@ void main(int argc, char **argv) lost+=labs(player_stuff.points); } } - FREE(buf); + free(buf); if (won || lost) { bprintf("\r\n\r\n\1m\1hYou've won \1y%ldK \1mand " "lost \1y%ldK \1mfor a total %s of " diff --git a/xtrn/sbl/sbbslist.c b/xtrn/sbl/sbbslist.c index 67adf8e2cc54de3f701df43bc887432d6999c3ea..fe9e59ad5e3c1b550b04cffd69f9c1647062e8c8 100644 --- a/xtrn/sbl/sbbslist.c +++ b/xtrn/sbl/sbbslist.c @@ -540,11 +540,11 @@ int main(int argc, char **argv) continue; } i++; - if((sort=(sort_t **)REALLOC(sort + if((sort=(sort_t **)realloc(sort ,sizeof(sort_t *)*i))==NULL) { printf("\r\n\7Memory allocation error\r\n"); return(1); } - if((sort[i-1]=(sort_t *)LMALLOC(sizeof(sort_t) + if((sort[i-1]=(sort_t *)malloc(sizeof(sort_t) ))==NULL) { printf("\r\n\7Memory allocation error\r\n"); return(1); } diff --git a/xtrn/sbl/sbl.c b/xtrn/sbl/sbl.c index 70d3e64496c7b41defc96fcaa542dec970320185..336bc18cc47ed24d813f929a324929f9d6e4b385 100644 --- a/xtrn/sbl/sbl.c +++ b/xtrn/sbl/sbl.c @@ -1243,19 +1243,19 @@ int main(int argc, char **argv) l=bbs.updated; break; } if(sort_by_str) { - if((sortstr=(sortstr_t *)REALLOC(sortstr + if((sortstr=(sortstr_t *)realloc(sortstr ,sizeof(sortstr_t)*i))==NULL) { bprintf("\r\n\7Memory allocation error\r\n"); - LFREE(sortstr); + free(sortstr); done=1; continue; } strcpy(sortstr[i-1].str,str); sortstr[i-1].offset=j-1; } else { - if((sortint=(sortint_t *)REALLOC(sortint + if((sortint=(sortint_t *)realloc(sortint ,sizeof(sortint_t)*i))==NULL) { bprintf("\r\n\7Memory allocation error\r\n"); - LFREE(sortint); + free(sortint); done=1; continue; } sortint[i-1].i=l; @@ -1277,9 +1277,9 @@ int main(int argc, char **argv) if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1) { bprintf("\r\n\7Error creating %s\r\n",str); if(sort_by_str) - LFREE(sortstr); + free(sortstr); else - LFREE(sortint); + free(sortint); pause(); break; } for(j=0;j<i;j++) @@ -1289,9 +1289,9 @@ int main(int argc, char **argv) write(file,&sortint[j].offset,2); close(file); if(sort_by_str) - LFREE(sortstr); + free(sortstr); else - LFREE(sortint); + free(sortint); bputs("\r\n\r\n\1n\1hDone.\r\n"); pause(); break; diff --git a/xtrn/sbl/smb2sbl.c b/xtrn/sbl/smb2sbl.c index e299e2a0b42429328c412635a6cc5177a837b312..1cf85b71d6f4112e06ee756f90c270e8b931f656 100644 --- a/xtrn/sbl/smb2sbl.c +++ b/xtrn/sbl/smb2sbl.c @@ -75,20 +75,20 @@ char *loadmsgtxt(smbmsg_t msg, int tails) length=msg.dfield[i].length-2; if(lzh) { length-=2; - if((lzhbuf=MALLOC(length))==NULL) { + if((lzhbuf=malloc(length))==NULL) { printf("ERR_ALLOC lzhbuf of %lu\n",length); return(buf); } fread(lzhbuf,1,length,smb.sdt_fp); lzhlen=*(long *)lzhbuf; - if((buf=REALLOC(buf,l+lzhlen+3))==NULL) { - FREE(lzhbuf); + if((buf=realloc(buf,l+lzhlen+3))==NULL) { + free(lzhbuf); printf("ERR_ALLOC lzhoutbuf of %ld\n",l+lzhlen+1); return(buf); } lzh_decode(lzhbuf,length,buf+l); - FREE(lzhbuf); + free(lzhbuf); l+=lzhlen; } else { - if((buf=REALLOC(buf,l+msg.dfield[i].length+3))==NULL) { + if((buf=realloc(buf,l+msg.dfield[i].length+3))==NULL) { printf("ERR_ALLOC of %lu\n",l+msg.dfield[i].length+1); return(buf); } l+=fread(buf+l,1,length,smb.sdt_fp); } @@ -505,7 +505,7 @@ int main(int argc, char **argv) bbs.total_numbers=number; if(fwrite(&bbs,1,sizeof(bbs_t),stream)!=sizeof(bbs_t)) fprintf(stderr,"!WRITE ERROR %d\n",errno); - FREE(buf); + free(buf); smb_freemsgmem(&msg); } lseek(file,0L,SEEK_SET); diff --git a/xtrn/sdk/xsdk.c b/xtrn/sdk/xsdk.c index 89c14594c78c0f272005fb26bab99810e1029f34..d3d356c21d5a0694ad886277208ae8b8ecac205e 100644 --- a/xtrn/sdk/xsdk.c +++ b/xtrn/sdk/xsdk.c @@ -1810,18 +1810,18 @@ void initdata(void) sprintf(mdm_answ,"%.63s",str); truncsp(mdm_answ); fgets(str,81,stream); /* memory address of modem status register */ - msr=(uint FAR16 *)atol(str); + msr=(uint *)atol(str); if(!fgets(str,81,stream)) /* total number of external programs */ total_xtrns=0; else total_xtrns=atoi(str); - if(total_xtrns && (xtrn=(char **)MALLOC(sizeof(char *)*total_xtrns))==NULL) { + if(total_xtrns && (xtrn=(char **)malloc(sizeof(char *)*total_xtrns))==NULL) { printf("Allocation error 1: %u\r\n",sizeof(char *)*total_xtrns); exit(1); } for(i=0;i<(int)total_xtrns;i++) { fgets(str,81,stream); truncsp(str); - if((xtrn[i]=(char *)MALLOC(strlen(str)+1))==NULL) { + if((xtrn[i]=(char *)malloc(strlen(str)+1))==NULL) { printf("Allocation error 2 (%u): %u\r\n",i,strlen(str)+1); exit(1); } strcpy(xtrn[i],str); } @@ -1953,7 +1953,7 @@ void initdata(void) exit(1); } fgets(tmp,81,stream); /* so get MSR address from file */ - msr=(uint FAR16 *)atol(tmp); + msr=(uint *)atol(tmp); fclose(stream); remove(str); } @@ -2088,7 +2088,7 @@ void printfile(char *str) bprintf("File not Found: %s\r\n",str); return; } length=filelength(file); - if((buf=MALLOC(length+1L))==NULL) { + if((buf=malloc(length+1L))==NULL) { close(file); bprintf("\7\r\nPRINTFILE: Error allocating %lu bytes of memory for %s.\r\n" ,length+1L,str); @@ -2097,7 +2097,7 @@ void printfile(char *str) close(file); bputs(buf); aborted=0; - FREE(buf); + free(buf); } /****************************************************************************/ @@ -2489,13 +2489,13 @@ void getsmsg(int usernumber) bprintf("\7Error opening %s for read/write access\r\n",str); return; } length=filelength(file); - if((buf=MALLOC(length+1))==NULL) { + if((buf=malloc(length+1))==NULL) { close(file); bprintf("\7Error allocating %u bytes of memory for %s\r\n",length+1,str); return; } if(read(file,buf,length)!=length) { close(file); - FREE(buf); + free(buf); bprintf("\7Error reading %u bytes from %s\r\n",length,str); return; } chsize(file,0L); @@ -2509,7 +2509,7 @@ void getsmsg(int usernumber) node.misc&=~NODE_MSGW; putnodedat(node_num,node); } bputs(buf); - FREE(buf); + free(buf); } /****************************************************************************/ @@ -2566,13 +2566,13 @@ void getnmsg(void) printf("Couldn't open %s for read/write\r\n",str); return; } length=filelength(file); - if((buf=MALLOC(length+1))==NULL) { + if((buf=malloc(length+1))==NULL) { close(file); printf("Couldn't allocate %lu bytes for %s\r\n",length+1,str); return; } if(read(file,buf,length)!=length) { close(file); - FREE(buf); + free(buf); printf("Couldn't read %lu bytes from %s\r\n",length,str); return; } chsize(file,0L); @@ -2580,7 +2580,7 @@ void getnmsg(void) buf[length]=0; bputs(buf); - FREE(buf); + free(buf); } /****************************************************************************/ diff --git a/xtrn/sdk/xsdkdefs.h b/xtrn/sdk/xsdkdefs.h index 7a40079c517004183e181c75c4a5ca99f0f6560e..b0c81e06c52ec40d24bf1421cc87465a5bca0edc 100644 --- a/xtrn/sdk/xsdkdefs.h +++ b/xtrn/sdk/xsdkdefs.h @@ -267,41 +267,16 @@ enum { /* Node Action */ /* 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 */ +/* is used to create a far (32-bit) pointer in 16-bit compilers */ +/* is used to create a huge (32-bit) pointer in 16-bit compilers */ /****************************************************************************/ -#if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__) - #define __16BIT__ - #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 KEY_BUFSIZE 256 diff --git a/xtrn/sdk/xsdkvars.c b/xtrn/sdk/xsdkvars.c index 9ffcccfadb1248a22166726a3199cbe6a6aede1b..2f55af4ca25f79cad4a94c215596c6caf9fc164a 100644 --- a/xtrn/sdk/xsdkvars.c +++ b/xtrn/sdk/xsdkvars.c @@ -124,7 +124,7 @@ GLOBAL char latr; /* Starting attribute of line buffer */ GLOBAL uint inDV; /* DESQview version if running under DV */ GLOBAL int keybuftop,keybufbot; /* Keyboard input buffer pointers */ GLOBAL char keybuf[KEY_BUFSIZE]; /* Keyboard input buffer */ -GLOBAL uint FAR16 *msr; /* Last modem status register contents */ +GLOBAL uint *msr; /* Last modem status register contents */ GLOBAL char **xtrn; /* List of external program names */ GLOBAL uint total_xtrns; /* Total number of external programs */ GLOBAL uchar lastnodemsg; /* Last node to send a message to */ diff --git a/xtrn/sdk/xsdkwrap.h b/xtrn/sdk/xsdkwrap.h index 035fa1d29307d885b18597f63c87894d830ce06a..9d88cb1096a34dd60057f510704a465216c4821e 100644 --- a/xtrn/sdk/xsdkwrap.h +++ b/xtrn/sdk/xsdkwrap.h @@ -81,8 +81,6 @@ #define PLATFORM_DESC "Win32" #elif defined(__OS2__) #define PLATFORM_DESC "OS/2" -#elif defined(__MSDOS__) - #define PLATFORM_DESC "DOS" #elif defined(__linux__) #define PLATFORM_DESC "Linux" #elif defined(__FreeBSD__) @@ -174,13 +172,6 @@ #define pthread_mutex_unlock(pmtx) ReleaseMutex(*(pmtx)) #define pthread_mutex_destroy(pmtx) CloseHandle(*(pmtx)) - -#elif defined(__MSDOS__) - - /* No semaphores */ - -#else - #warning "Need semaphore wrappers." #endif @@ -215,10 +206,6 @@ char* _fullpath(char* absPath, const char* relPath ,size_t maxLength); -#elif defined(__MSDOS__) - - void mswait(int ms); /* Wait a specific number of milliseconds */ - #else /* Unsupported OS */ #warning "Unsupported Target: Need some macros of function prototypes here."