From: keie Date: Mon, 21 Jan 1985 23:56:10 +0000 (+0000) Subject: Added correct declaration of salloc, thereby preventing incorrect conversions. X-Git-Tag: release-5-5~5733 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=68644410fbe2751c8fb99997cf6419fd92068e54;p=ack.git Added correct declaration of salloc, thereby preventing incorrect conversions. Removed now unnecessary casts from salloc to (char *). Added a cast to (char *) for the argument of sfree in the second call. --- diff --git a/lang/basic/lib/string.c b/lang/basic/lib/string.c index 1c9d4aa12..5f7d2fa36 100644 --- a/lang/basic/lib/string.c +++ b/lang/basic/lib/string.c @@ -5,6 +5,8 @@ #define ok(X) if( X ==0) return; #define okr(X) if( X ==0) return(0); +extern char *salloc() ; + _len(str) String *str; { @@ -19,7 +21,7 @@ char *str; s= (String *) salloc(sizeof(String)); s->strcount=1; s->strlength= strlen(str); - s->strval= (char *) salloc(s->strlength+1); + s->strval= salloc(s->strlength+1); strcpy(s->strval,str); return(s); } @@ -51,7 +53,7 @@ String *src; { ok(src); sfree(src->strval); - sfree(src); + sfree((char *)src); } String *_concat(s1,s2) String *s1,*s2; @@ -61,7 +63,7 @@ String *s1,*s2; okr(s1); okr(s2); s= (String *) salloc(sizeof(String)); length= _len(s1)+_len(s2)+1; - s->strval= (char *) salloc(length); + s->strval= salloc(length); strcpy(s->strval,s2->strval); strcat(s->strval,s1->strval); return(s); @@ -83,7 +85,7 @@ int size; okr(s); if( size <0 || size >s->strlength) error(3); ns= (String *) salloc(sizeof(String)); - ns->strval= (char *) salloc(size+1); + ns->strval= salloc(size+1); ns->strcount=1; for(i=0; istrval[i];i++) ns->strval[i]= s->strval[i]; @@ -102,7 +104,7 @@ int d; s= (String *) salloc(sizeof(String)); s->strlength= len; s->strcount=1; - s->strval= (char *) salloc(len+1); + s->strval= salloc(len+1); for(i=0;istrval[i]= ' '; s->strval[i]=0; @@ -123,7 +125,7 @@ double d,f; s= (String *) salloc(sizeof(String)); s->strlength= i; s->strcount=1; - s->strval= (char *) salloc(i+1); + s->strval= salloc(i+1); s->strval[i]=0; for(; i>=0;i--) s->strval[i]= j;