From 6e9e8e2e5196aa3227fcebb3e09aba5a450a5f2d Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 24 Oct 2010 13:32:17 +0000 Subject: [PATCH] trealloc usage unification --- ChangeLog | 5 +++++ src/frontend/inpcom.c | 4 ++-- src/frontend/subckt.c | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a02e58e7..b8604fceb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 3fda28975..8e3041c22 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -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); } diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 7bd17772a..c08801ea8 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -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;