1 - Changed argument from int to unsigned.
2 - The test for a failed malloc is changed from comparison to -1 to comparison to 0.
This commit is contained in:
parent
d4a597912f
commit
c2e988c3d5
1 changed files with 2 additions and 2 deletions
|
@ -3,11 +3,11 @@
|
||||||
extern char *malloc() ;
|
extern char *malloc() ;
|
||||||
|
|
||||||
char * salloc(length)
|
char * salloc(length)
|
||||||
int length;
|
unsigned length;
|
||||||
{
|
{
|
||||||
char *c, *s;
|
char *c, *s;
|
||||||
c= malloc(length);
|
c= malloc(length);
|
||||||
if( c== (char *) -1) error(5);
|
if( !c ) error(5);
|
||||||
for(s=c;s<c+length;s++) *s = 0;
|
for(s=c;s<c+length;s++) *s = 0;
|
||||||
return(c);
|
return(c);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue