trealloc usage unification

This commit is contained in:
rlar 2010-10-24 13:32:17 +00:00
parent 7e8f7d08a7
commit 6e9e8e2e51
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2010-10-24 Robert Larice
* src/frontend/inpcom.c ,
* src/frontend/subckt.c :
trealloc usage unification
2010-10-24 Robert Larice
* src/spicelib/devices/ltra/ltramisc.c :
MALLOC usage unification, (in comments)

View File

@ -139,7 +139,7 @@ readline(FILE *fd)
strlen++;
if( strlen >= memlen ) {
memlen += STRGROW;
if( !(strptr = (char*) trealloc(strptr, memlen + 1))) {
if( !(strptr = (char*) trealloc(strptr, (memlen + 1)*sizeof(char)))) {
return (NULL);
}
}
@ -153,7 +153,7 @@ readline(FILE *fd)
}
// strptr[strlen] = '\0';
/* Trim the string */
strptr = (char*) trealloc(strptr, strlen + 1);
strptr = (char*) trealloc(strptr, (strlen + 1)*sizeof(char));
strptr[strlen] = '\0';
return (strptr);
}

View File

@ -786,7 +786,9 @@ bxx_extend(struct bxx_buffer *t, int howmuch)
howmuch += (bxx_chunksize - 1);
howmuch &= ~(bxx_chunksize - 1);
t->buffer = (char*) trealloc(t->buffer, len += howmuch);
len += howmuch;
t->buffer = (char*) trealloc(t->buffer, len*sizeof(char));
t->dst = t->buffer + pos;
t->limit = t->buffer + len;