diff --git a/src/syncdraw/block.c b/src/syncdraw/block.c index 9103c8be68af3ddc0b3e3dcd63ec6377bdcb72f6..b1a0d72eba1fa7e3836f9c2db808c0afde2e15a7 100644 --- a/src/syncdraw/block.c +++ b/src/syncdraw/block.c @@ -81,7 +81,7 @@ CopyBlock(char Mode) Dragging=TRUE; do { - buf=(char *)malloc(80*ti.screenheight*2); + buf=(char *)alloca(80*ti.screenheight*2); memcpy(buf,Screen[ActivePage][FirstLine],80*ti.screenheight*2); for (y=Y1;y<=Y2;y++) { @@ -262,7 +262,7 @@ blockmode(void) X1 = CursorX; } - buf=(char *)malloc(80*ti.screenheight*2); + buf=(char *)alloca(80*ti.screenheight*2); memcpy(buf,Screen[ActivePage][FirstLine],80*ti.screenheight*2); for(y=Y1-FirstLine;y<=Y2-FirstLine;y++) { for(x=X1;x<=X2;x++) { @@ -273,7 +273,6 @@ blockmode(void) puttext(1,1,80,ti.screenheight-1,buf); else puttext(1,2,80,ti.screenheight-1,buf); - free(buf); Statusline(); Colors(Attribute); diff --git a/src/syncdraw/crt.c b/src/syncdraw/crt.c index aef43a51dabbd8388f9ee7a62bfe582c6df7414a..66f9cff802fb8b8245b6701146c47b58e0ae26f4 100644 --- a/src/syncdraw/crt.c +++ b/src/syncdraw/crt.c @@ -15,9 +15,9 @@ DrawBox(int x1, int y1, int x2, int y2) width=x2-x1+3; height=y2-y1+1; if(width>height) - buf=(char *)malloc(width*2); + buf=(char *)alloca(width*2); else - buf=(char *)malloc(height*2); + buf=(char *)alloca(height*2); i=0; buf[i++]=218; @@ -47,5 +47,4 @@ DrawBox(int x1, int y1, int x2, int y2) } puttext(x1,y1+1,x1,y2-1,buf); puttext(x2,y1+1,x2,y2-1,buf); - free(buf); } diff --git a/src/syncdraw/effekt.c b/src/syncdraw/effekt.c index 0a7ec57359060e6fc99eff366d007d1905ad48f9..6ffafb5ef188a370d333cdf36a9d568be8bb6506 100644 --- a/src/syncdraw/effekt.c +++ b/src/syncdraw/effekt.c @@ -22,7 +22,7 @@ draweffekt(int xpos, int ypos, int effekt, char *blabla, int highlite) col = effect.Colortable[1][1]; l=strlen(blabla); - buf=(char *)malloc(l*2); + buf=(char *)alloca(l*2); p=0; for (x = 0; x < l; x++) { @@ -76,7 +76,6 @@ draweffekt(int xpos, int ypos, int effekt, char *blabla, int highlite) buf[p++]=col+(highlite?16:0); } puttext(xpos,ypos,xpos+l-1,ypos,buf); - free(buf); } void diff --git a/src/syncdraw/miscfunctions.c b/src/syncdraw/miscfunctions.c index 7fa6bd15377da844683e4109a0968d6caafaf8fa..6032b18641ab79c3f6b6de45b9906d7cb3a8d519 100644 --- a/src/syncdraw/miscfunctions.c +++ b/src/syncdraw/miscfunctions.c @@ -102,7 +102,7 @@ CoolWrite(int x, int y, char *a) int b = 0, i = 0, j = 0; char *buf; - buf=(char *)malloc(strlen(a)*2); + buf=(char *)alloca(strlen(a)*2); while (a[b] != 0) { i++; if (a[b] == 32) @@ -122,7 +122,6 @@ CoolWrite(int x, int y, char *a) } } puttext(x, y, x+strlen(a)-1,y,buf); - free(buf); } void CodeWrite(int x, int y, char *a) @@ -130,7 +129,7 @@ CodeWrite(int x, int y, char *a) int b = 0, i = 0, attr=15; char *buf; - buf=(char *)malloc(strlen(a)*2); + buf=(char *)alloca(strlen(a)*2); while (a[b] != 0) { if (a[b] == ']') attr=15; @@ -141,7 +140,6 @@ CodeWrite(int x, int y, char *a) b++; } puttext(x,y,x+strlen(a)-1,y,buf); - free(buf); } unsigned char @@ -453,7 +451,7 @@ inputfield(char *Str, int length, int x1, int y) char *buf; int oldx,oldy; - buf=(char *)malloc(length*2); + buf=(char *)alloca(length*2); strcpy(nul,Str); oldx=wherex(); oldy=wherey(); @@ -507,8 +505,6 @@ inputfield(char *Str, int length, int x1, int y) } } while ((ch != 13) & (ch != 27)); - free(buf); - gotoxy(oldx,oldy); if (ch == 27) return Str; @@ -550,7 +546,7 @@ int bufprintf(char *buf, int attr, char *fmat, ...) ret=_vsnprintf(str,sizeof(str)-1,fmat,argptr); #else ret=vsnprintf(NULL,0,fmat,argptr); - str=(char *)malloc(ret+1); + str=(char *)alloca(ret+1); if(str==NULL) return(EOF); ret=vsprintf(str,fmat,argptr); @@ -564,8 +560,5 @@ int bufprintf(char *buf, int attr, char *fmat, ...) } else i=EOF; -#ifndef _WIN32 - free(str); -#endif return(i); }