* src/main.c, src/multidec.c, src/proc2mod.c,
src/frontend/display.c, src/frontend/outitf.c, src/frontend/help/readhelp.c, src/frontend/help/x11disp.c, src/frontend/parser/complete.c, src/frontend/parser/glob.c, src/frontend/plotting/graf.c, src/frontend/plotting/graphdb.c, src/frontend/plotting/x11.c, src/include/graph.h, src/include/iferrmsg.h, src/include/ifsim.h, src/include/macros.h, src/maths/poly/polyfit.c, src/maths/sparse/spalloc.c, src/maths/sparse/spconfig.h, src/misc/alloc.c, src/misc/mktemp.c, src/spicelib/analysis/cktpzstr.c, src/spicelib/devices/bsim2/b2temp.c, src/spicelib/devices/bsim3/b3temp.c, src/spicelib/devices/bsim3v1/b3v1temp.c, src/spicelib/devices/bsim3v2/b3v2temp.c, src/spicelib/devices/bsim4/b4temp.c: replaced malloc realloc and free calls to use tmalloc trealloc and txfree. * tests/diffpair.out, tests/fourbitadder.out, tests/resistance/res_partition.out: Updated.
This commit is contained in:
parent
03cf985d1a
commit
cc51f0e8db
|
|
@ -1,3 +1,8 @@
|
||||||
|
2000-10-14 Arno W. Peters <A.W.Peters@ieee.org>
|
||||||
|
|
||||||
|
* *: replaced malloc, realloc and free calls to use tmalloc,
|
||||||
|
trealloc and txfree.
|
||||||
|
|
||||||
2000-09-05 Arno W. Peters <A.W.Peters@ieee.org>
|
2000-09-05 Arno W. Peters <A.W.Peters@ieee.org>
|
||||||
|
|
||||||
* ???: Paolo and I have integrated patches from Alan Gillespie
|
* ???: Paolo and I have integrated patches from Alan Gillespie
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ void SaveText(GRAPH *graph, char *text, int x, int y)
|
||||||
|
|
||||||
struct _keyed *keyed;
|
struct _keyed *keyed;
|
||||||
|
|
||||||
keyed = (struct _keyed *) calloc(1, sizeof(struct _keyed));
|
keyed = (struct _keyed *) tmalloc(sizeof(struct _keyed));
|
||||||
|
|
||||||
if (!graph->keyed) {
|
if (!graph->keyed) {
|
||||||
graph->keyed = keyed;
|
graph->keyed = keyed;
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ static toplink *getsubtoplink(char **ss)
|
||||||
if ((tmp =strchr(s, ':'))) {
|
if ((tmp =strchr(s, ':'))) {
|
||||||
tl->place = alloc(fplace);
|
tl->place = alloc(fplace);
|
||||||
tl->place->filename = strncpy(
|
tl->place->filename = strncpy(
|
||||||
calloc(1, (unsigned) (sizeof (char) * (tmp - s + 1))),
|
tmalloc((unsigned) (sizeof (char) * (tmp - s + 1))),
|
||||||
s, (tmp - s));
|
s, (tmp - s));
|
||||||
tl->place->filename[tmp - s] = '\0';
|
tl->place->filename[tmp - s] = '\0';
|
||||||
strtolower(tl->place->filename);
|
strtolower(tl->place->filename);
|
||||||
|
|
@ -314,7 +314,7 @@ copy_fplace(fplace *place)
|
||||||
{
|
{
|
||||||
fplace *newplace;
|
fplace *newplace;
|
||||||
|
|
||||||
newplace = (fplace *) malloc(sizeof(fplace));
|
newplace = (fplace *) tmalloc(sizeof(fplace));
|
||||||
newplace->filename = copy(place->filename);
|
newplace->filename = copy(place->filename);
|
||||||
newplace->fpos = place->fpos;
|
newplace->fpos = place->fpos;
|
||||||
newplace->fp = place->fp;
|
newplace->fp = place->fp;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ hlp_xdisplay(topic *top)
|
||||||
commandWidgetClass, top->subboxwidget, buttonargs,
|
commandWidgetClass, top->subboxwidget, buttonargs,
|
||||||
XtNumber(buttonargs));
|
XtNumber(buttonargs));
|
||||||
/* core leak XXX */
|
/* core leak XXX */
|
||||||
hand = (handle *) calloc(1, sizeof (struct handle));
|
hand = (handle *) tmalloc(sizeof (struct handle));
|
||||||
hand->result = tl;
|
hand->result = tl;
|
||||||
hand->parent = top;
|
hand->parent = top;
|
||||||
XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) newtopic, hand);
|
XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) newtopic, hand);
|
||||||
|
|
@ -177,7 +177,7 @@ hlp_xdisplay(topic *top)
|
||||||
XtSetArg(buttonargs[0], XtNlabel, tl->button.text);
|
XtSetArg(buttonargs[0], XtNlabel, tl->button.text);
|
||||||
buttonwidget = XtCreateManagedWidget(tl->button.text,
|
buttonwidget = XtCreateManagedWidget(tl->button.text,
|
||||||
commandWidgetClass, top->seeboxwidget, buttonargs, 1);
|
commandWidgetClass, top->seeboxwidget, buttonargs, 1);
|
||||||
hand = (handle *) calloc(1, sizeof (struct handle));
|
hand = (handle *) tmalloc(sizeof (struct handle));
|
||||||
/* core leak XXX */
|
/* core leak XXX */
|
||||||
hand->result = tl;
|
hand->result = tl;
|
||||||
hand->parent = top;
|
hand->parent = top;
|
||||||
|
|
|
||||||
|
|
@ -1217,17 +1217,14 @@ freeRun(runDesc *run)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < run->numData; i++) {
|
for (i=0; i < run->numData; i++) {
|
||||||
/* vec_free(run->data[i].vec); */ /* kill run, leave plot */
|
|
||||||
tfree(run->data[i].name);
|
tfree(run->data[i].name);
|
||||||
tfree(run->data[i].specParamName);
|
tfree(run->data[i].specParamName);
|
||||||
}
|
}
|
||||||
tfree(run->data);
|
tfree(run->data);
|
||||||
|
|
||||||
/* killplot(run->runPlot); */ /* kill run, leave plot */
|
tfree(run->type);
|
||||||
|
tfree(run->name);
|
||||||
free(run->type);
|
tfree(run);
|
||||||
free(run->name);
|
|
||||||
free(run);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -680,11 +680,11 @@ static void
|
||||||
cdelete(struct ccom *node)
|
cdelete(struct ccom *node)
|
||||||
{
|
{
|
||||||
node->cc_invalid = 1;
|
node->cc_invalid = 1;
|
||||||
free(node->cc_name);
|
tfree(node->cc_name);
|
||||||
free(node->cc_child);
|
tfree(node->cc_child);
|
||||||
free(node->cc_sibling);
|
tfree(node->cc_sibling);
|
||||||
free(node->cc_ysibling);
|
tfree(node->cc_ysibling);
|
||||||
free(node->cc_parent);
|
tfree(node->cc_parent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ cp_doglob(wordlist *wlist)
|
||||||
if (*wl->wl_word == cp_til) {
|
if (*wl->wl_word == cp_til) {
|
||||||
s = cp_tildexpand(wl->wl_word);
|
s = cp_tildexpand(wl->wl_word);
|
||||||
if (!s)
|
if (!s)
|
||||||
*wl->wl_word = '\0'; /* MW. We Con't touch malloc addres */
|
*wl->wl_word = '\0'; /* MW. We Con't touch tmalloc addres */
|
||||||
else
|
else
|
||||||
wl->wl_word = s;
|
wl->wl_word = s;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
|
||||||
/* note: have enum here or some better convention */
|
/* note: have enum here or some better convention */
|
||||||
if (NewViewport(graph) == 1) {
|
if (NewViewport(graph) == 1) {
|
||||||
/* note: where is the error message generated? */
|
/* note: where is the error message generated? */
|
||||||
/* note: undo mallocs */
|
/* note: undo tmallocs */
|
||||||
fprintf(cp_err, "Can't open viewport for graphics.\n");
|
fprintf(cp_err, "Can't open viewport for graphics.\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
@ -368,7 +368,7 @@ gr_start_internal(struct dvec *dv, bool copyvec)
|
||||||
dv->v_color = curcolor;
|
dv->v_color = curcolor;
|
||||||
|
|
||||||
/* save the data so we can refresh */
|
/* save the data so we can refresh */
|
||||||
link = (struct dveclist *) calloc(1, sizeof(struct dveclist));
|
link = (struct dveclist *) tmalloc(sizeof(struct dveclist));
|
||||||
link->next = currentgraph->plotdata;
|
link->next = currentgraph->plotdata;
|
||||||
|
|
||||||
if (copyvec) {
|
if (copyvec) {
|
||||||
|
|
|
||||||
|
|
@ -26,18 +26,17 @@ GRAPH *currentgraph;
|
||||||
|
|
||||||
/* linked list of graphs */
|
/* linked list of graphs */
|
||||||
typedef struct listgraph {
|
typedef struct listgraph {
|
||||||
/* we use GRAPH here instead of a pointer to save a calloc */
|
/* we use GRAPH here instead of a pointer to save a tmalloc */
|
||||||
GRAPH graph;
|
GRAPH graph;
|
||||||
struct listgraph *next;
|
struct listgraph *next;
|
||||||
} LISTGRAPH;
|
} LISTGRAPH;
|
||||||
#define NEWLISTGRAPH (LISTGRAPH *) calloc(1, sizeof(LISTGRAPH))
|
#define NEWLISTGRAPH (LISTGRAPH *) tmalloc(sizeof(LISTGRAPH))
|
||||||
|
|
||||||
#define NUMGBUCKETS 16
|
#define NUMGBUCKETS 16
|
||||||
|
|
||||||
typedef struct gbucket {
|
typedef struct gbucket {
|
||||||
LISTGRAPH *list;
|
LISTGRAPH *list;
|
||||||
} GBUCKET;
|
} GBUCKET;
|
||||||
/* #define NEWGBUCKET (GBUCKET *) calloc(1, sizeof(GBUCKET)) */
|
|
||||||
|
|
||||||
static GBUCKET GBucket[NUMGBUCKETS];
|
static GBUCKET GBucket[NUMGBUCKETS];
|
||||||
|
|
||||||
|
|
@ -122,7 +121,7 @@ GRAPH *CopyGraph(GRAPH *graph)
|
||||||
/* copy dvecs */
|
/* copy dvecs */
|
||||||
ret->plotdata = NULL;
|
ret->plotdata = NULL;
|
||||||
for (link = graph->plotdata; link; link = link->next) {
|
for (link = graph->plotdata; link; link = link->next) {
|
||||||
newlink = (struct dveclist *) calloc(1, sizeof(struct dveclist));
|
newlink = (struct dveclist *) tmalloc(sizeof(struct dveclist));
|
||||||
newlink->next = ret->plotdata;
|
newlink->next = ret->plotdata;
|
||||||
newlink->vector = vec_copy(link->vector);
|
newlink->vector = vec_copy(link->vector);
|
||||||
/* vec_copy doesn't set v_color or v_linestyle */
|
/* vec_copy doesn't set v_color or v_linestyle */
|
||||||
|
|
@ -176,8 +175,8 @@ DestroyGraph(int id)
|
||||||
k=list->graph.keyed;
|
k=list->graph.keyed;
|
||||||
while (k) {
|
while (k) {
|
||||||
nextk = k->next;
|
nextk = k->next;
|
||||||
free(k->text);
|
tfree(k->text);
|
||||||
free(k);
|
tfree(k);
|
||||||
k = nextk;
|
k = nextk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,18 +190,18 @@ DestroyGraph(int id)
|
||||||
} else {
|
} else {
|
||||||
tfree(d->vector->v_compdata);
|
tfree(d->vector->v_compdata);
|
||||||
}
|
}
|
||||||
free(d->vector);
|
tfree(d->vector);
|
||||||
free(d);
|
tfree(d);
|
||||||
d = nextd;
|
d = nextd;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(list->graph.commandline);
|
tfree(list->graph.commandline);
|
||||||
free(list->graph.plotname);
|
tfree(list->graph.plotname);
|
||||||
|
|
||||||
/* If device dependent space allocated, free it. */
|
/* If device dependent space allocated, free it. */
|
||||||
if (list->graph.devdep)
|
if (list->graph.devdep)
|
||||||
free(list->graph.devdep);
|
tfree(list->graph.devdep);
|
||||||
free(list);
|
tfree(list);
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +227,7 @@ FreeGraphs(void)
|
||||||
while (list) {
|
while (list) {
|
||||||
deadl = list;
|
deadl = list;
|
||||||
list = list->next;
|
list = list->next;
|
||||||
free(deadl);
|
tfree(deadl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,7 +246,7 @@ typedef struct gcstack {
|
||||||
struct gcstack *next;
|
struct gcstack *next;
|
||||||
} GCSTACK;
|
} GCSTACK;
|
||||||
GCSTACK *gcstacktop;
|
GCSTACK *gcstacktop;
|
||||||
#define NEWGCSTACK (GCSTACK *) calloc(1, sizeof(GCSTACK))
|
#define NEWGCSTACK (GCSTACK *) tmalloc(sizeof(GCSTACK))
|
||||||
|
|
||||||
/* note: This Push and Pop has tricky semantics.
|
/* note: This Push and Pop has tricky semantics.
|
||||||
Push(graph) will push the currentgraph onto the stack
|
Push(graph) will push the currentgraph onto the stack
|
||||||
|
|
@ -280,6 +279,5 @@ PopGraphContext(void)
|
||||||
currentgraph = gcstacktop->pgraph;
|
currentgraph = gcstacktop->pgraph;
|
||||||
dead = gcstacktop;
|
dead = gcstacktop;
|
||||||
gcstacktop = gcstacktop->next;
|
gcstacktop = gcstacktop->next;
|
||||||
free(dead);
|
tfree(dead);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ handlebuttonev(Widget w, caddr_t clientdata, caddr_t calldata)
|
||||||
|
|
||||||
|
|
||||||
/* Recover from bad NewViewPort call. */
|
/* Recover from bad NewViewPort call. */
|
||||||
#define RECOVERNEWVIEWPORT() free((char *) graph);\
|
#define RECOVERNEWVIEWPORT() tfree((char *) graph);\
|
||||||
graph = (GRAPH *) NULL;
|
graph = (GRAPH *) NULL;
|
||||||
/* need to do this or else DestroyGraph will free it again */
|
/* need to do this or else DestroyGraph will free it again */
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ X11_NewViewport(GRAPH *graph)
|
||||||
};
|
};
|
||||||
int trys;
|
int trys;
|
||||||
|
|
||||||
graph->devdep = calloc(1, sizeof(X11devdep));
|
graph->devdep = tmalloc(sizeof(X11devdep));
|
||||||
|
|
||||||
/* set up new shell */
|
/* set up new shell */
|
||||||
DEVDEP(graph).shell = XtCreateApplicationShell("shell",
|
DEVDEP(graph).shell = XtCreateApplicationShell("shell",
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ typedef struct graph {
|
||||||
|
|
||||||
} GRAPH;
|
} GRAPH;
|
||||||
|
|
||||||
#define NEWGRAPH (GRAPH *) calloc(1, sizeof(GRAPH))
|
#define NEWGRAPH (GRAPH *) tmalloc(sizeof(GRAPH))
|
||||||
|
|
||||||
#define rnd(x) (int) ((x)+0.5)
|
#define rnd(x) (int) ((x)+0.5)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ Author: 1986 Thomas L. Quarles
|
||||||
/* changed in the future */
|
/* changed in the future */
|
||||||
|
|
||||||
extern char *errMsg; /* descriptive message about what went wrong */
|
extern char *errMsg; /* descriptive message about what went wrong */
|
||||||
/* MUST be malloc()'d - front end will free() */
|
/* MUST be tmalloc()'d - front end will tfree() */
|
||||||
/* this should be a detailed message,and is assumed */
|
/* this should be a detailed message,and is assumed */
|
||||||
/* malloc()'d so that you will feel free to add */
|
/* tmalloc()'d so that you will feel free to add */
|
||||||
/* lots of descriptive information with sprintf*/
|
/* lots of descriptive information with sprintf*/
|
||||||
|
|
||||||
extern char *errRtn; /* name of the routine declaring error */
|
extern char *errRtn; /* name of the routine declaring error */
|
||||||
/* should not be malloc()'d, will not be free()'d */
|
/* should not be tmalloc()'d, will not be free()'d */
|
||||||
/* This should be a simple constant in your routine */
|
/* This should be a simple constant in your routine */
|
||||||
/* and thus can be set correctly even if we run out */
|
/* and thus can be set correctly even if we run out */
|
||||||
/* of memory */
|
/* of memory */
|
||||||
|
|
|
||||||
|
|
@ -173,14 +173,14 @@ typedef struct sIFparseTree {
|
||||||
* should arrange to free it when appropriate.
|
* should arrange to free it when appropriate.
|
||||||
*
|
*
|
||||||
* The responsibilities of the data supplier are:
|
* The responsibilities of the data supplier are:
|
||||||
* Any vectors referenced by the structure are to be malloc()'d
|
* Any vectors referenced by the structure are to be tmalloc()'d
|
||||||
* and are assumed to have been turned over to the recipient and
|
* and are assumed to have been turned over to the recipient and
|
||||||
* thus should not be re-used or free()'d.
|
* thus should not be re-used or tfree()'d.
|
||||||
*
|
*
|
||||||
* The responsibilities of the data recipient are:
|
* The responsibilities of the data recipient are:
|
||||||
* scalar valued data is to be copied by the recipient
|
* scalar valued data is to be copied by the recipient
|
||||||
* vector valued data is now the property of the recipient,
|
* vector valued data is now the property of the recipient,
|
||||||
* and must be free()'d when no longer needed.
|
* and must be tfree()'d when no longer needed.
|
||||||
*
|
*
|
||||||
* Character strings are a special case: Since it is assumed
|
* Character strings are a special case: Since it is assumed
|
||||||
* that all character strings are directly descended from input
|
* that all character strings are directly descended from input
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#define tfree(x) (txfree(x), x = 0)
|
#define tfree(x) (txfree(x), x = 0)
|
||||||
#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE)))
|
#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE)))
|
||||||
#define MALLOC(x) tmalloc((unsigned)(x))
|
#define MALLOC(x) tmalloc((unsigned)(x))
|
||||||
#define FREE(x) {if (x) {free((char *)(x));(x) = 0;}}
|
#define FREE(x) {if (x) {txfree((char *)(x));(x) = 0;}}
|
||||||
#define REALLOC(x,y) trealloc((char *)(x),(unsigned)(y))
|
#define REALLOC(x,y) trealloc((char *)(x),(unsigned)(y))
|
||||||
#define ZERO(PTR,TYPE) (bzero((PTR),sizeof(TYPE)))
|
#define ZERO(PTR,TYPE) (bzero((PTR),sizeof(TYPE)))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -503,9 +503,6 @@ main(int argc, char **argv)
|
||||||
asprintf(&s, "%s/.spiceinit", pw->pw_dir);
|
asprintf(&s, "%s/.spiceinit", pw->pw_dir);
|
||||||
if (access(s, 0) == 0)
|
if (access(s, 0) == 0)
|
||||||
inp_source(s);
|
inp_source(s);
|
||||||
/* free(s); */
|
|
||||||
/* FIXME: Do we need to free() char* fields in pw as well? */
|
|
||||||
/* free(pw); */
|
|
||||||
}
|
}
|
||||||
#else /* ~ HAVE_PWD_H */
|
#else /* ~ HAVE_PWD_H */
|
||||||
/* Try to source the file "spice.rc" in the current directory. */
|
/* Try to source the file "spice.rc" in the current directory. */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* Takes n = (degree+1) doubles, and fills in result with the n
|
/* Takes n = (degree+1) doubles, and fills in result with the n
|
||||||
* coefficients of the polynomial that will fit them. It also takes a
|
* coefficients of the polynomial that will fit them. It also takes a
|
||||||
* pointer to an array of n ^ 2 + n doubles to use for scratch -- we
|
* pointer to an array of n ^ 2 + n doubles to use for scratch -- we
|
||||||
* want to make this fast and avoid doing mallocs for each call. */
|
* want to make this fast and avoid doing tmallocs for each call. */
|
||||||
bool
|
bool
|
||||||
ft_polyfit(double *xdata, double *ydata, double *result,
|
ft_polyfit(double *xdata, double *ydata, double *result,
|
||||||
int degree, double *scratch)
|
int degree, double *scratch)
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ spcGetFillin(MatrixPtr Matrix)
|
||||||
* Matrix <input> (MatrixPtr)
|
* Matrix <input> (MatrixPtr)
|
||||||
* Pointer to the matrix.
|
* Pointer to the matrix.
|
||||||
* AllocatedPtr <input> (void *)
|
* AllocatedPtr <input> (void *)
|
||||||
* The pointer returned by malloc or calloc. These pointers are
|
* The pointer returned by tmalloc or calloc. These pointers are
|
||||||
* saved in a list so that they can be easily freed.
|
* saved in a list so that they can be easily freed.
|
||||||
*
|
*
|
||||||
* >>> Possible errors:
|
* >>> Possible errors:
|
||||||
|
|
@ -542,7 +542,7 @@ static void
|
||||||
RecordAllocation(MatrixPtr Matrix, void *AllocatedPtr )
|
RecordAllocation(MatrixPtr Matrix, void *AllocatedPtr )
|
||||||
{
|
{
|
||||||
/* Begin `RecordAllocation'. */
|
/* Begin `RecordAllocation'. */
|
||||||
/* If Allocated pointer is NULL, assume that malloc returned a
|
/* If Allocated pointer is NULL, assume that tmalloc returned a
|
||||||
* NULL pointer, which indicates a spNO_MEMORY error. */
|
* NULL pointer, which indicates a spNO_MEMORY error. */
|
||||||
if (AllocatedPtr == NULL) {
|
if (AllocatedPtr == NULL) {
|
||||||
Matrix->Error = spNO_MEMORY;
|
Matrix->Error = spNO_MEMORY;
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,7 @@
|
||||||
* of elements for which memory is initially allocated and specifically
|
* of elements for which memory is initially allocated and specifically
|
||||||
* reserved for fill-ins in spCreate(). [4]
|
* reserved for fill-ins in spCreate(). [4]
|
||||||
* ELEMENTS_PER_ALLOCATION
|
* ELEMENTS_PER_ALLOCATION
|
||||||
* The number of matrix elements requested from the malloc utility on
|
* The number of matrix elements requested from the tmalloc utility on
|
||||||
* each call to it. Setting this value greater than 1 reduces the
|
* each call to it. Setting this value greater than 1 reduces the
|
||||||
* amount of overhead spent in this system call. On a virtual memory
|
* amount of overhead spent in this system call. On a virtual memory
|
||||||
* machine, its good to allocate slightly less than a page worth of
|
* machine, its good to allocate slightly less than a page worth of
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
|
|
||||||
|
|
||||||
/* Malloc num bytes and initialize to zero. Fatal error if the space can't
|
/* Malloc num bytes and initialize to zero. Fatal error if the space can't
|
||||||
* be malloc'd. Return NULL for a request for 0 bytes.
|
* be tmalloc'd. Return NULL for a request for 0 bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* New implementation of tmalloc, it uses calloc and does not call bzero() */
|
/* New implementation of tmalloc, it uses calloc and does not call bzero() */
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ smktemp(char *id)
|
||||||
id = "sp";
|
id = "sp";
|
||||||
|
|
||||||
sprintf(rbuf, TEMPFORMAT, id, num);
|
sprintf(rbuf, TEMPFORMAT, id, num);
|
||||||
nbuf = (char *) malloc(strlen(rbuf) + 1);
|
nbuf = (char *) tmalloc(strlen(rbuf) + 1);
|
||||||
strcpy(nbuf, rbuf);
|
strcpy(nbuf, rbuf);
|
||||||
|
|
||||||
return nbuf;
|
return nbuf;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ int
|
||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'o':
|
case 'o':
|
||||||
name = (char *) malloc((unsigned) (strlen(optarg)*sizeof(char)));
|
name = (char *) tmalloc((unsigned) (strlen(optarg)*sizeof(char)));
|
||||||
(void) strcpy(name,optarg);
|
(void) strcpy(name,optarg);
|
||||||
gotname=1;
|
gotname=1;
|
||||||
use_opt = 1;
|
use_opt = 1;
|
||||||
|
|
@ -158,13 +158,13 @@ int
|
||||||
|
|
||||||
comments(r,l,g,c,ctot,cm,lm,k,name,num,len);
|
comments(r,l,g,c,ctot,cm,lm,k,name,num,len);
|
||||||
|
|
||||||
matrix = (double **) malloc((unsigned) (sizeof(double*)*(num+1)));
|
matrix = (double **) tmalloc((unsigned) (sizeof(double*)*(num+1)));
|
||||||
inverse = (double **) malloc((unsigned) (sizeof(double*)*(num+1)));
|
inverse = (double **) tmalloc((unsigned) (sizeof(double*)*(num+1)));
|
||||||
tpeigenvalues = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
tpeigenvalues = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
|
|
||||||
for (i=1;i<=num;i++) {
|
for (i=1;i<=num;i++) {
|
||||||
matrix[i] = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
matrix[i] = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
inverse[i] = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
inverse[i] = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=1;i<=num;i++) {
|
for (i=1;i<=num;i++) {
|
||||||
|
|
@ -176,7 +176,7 @@ int
|
||||||
matrix[i][j] = phi(i-1,tpeigenvalues[j]);
|
matrix[i][j] = phi(i-1,tpeigenvalues[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gammaj = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
gammaj = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
|
|
||||||
for (j=1;j<=num;j++) {
|
for (j=1;j<=num;j++) {
|
||||||
gammaj[j] = 0.0;
|
gammaj[j] = 0.0;
|
||||||
|
|
@ -192,7 +192,7 @@ int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(gammaj);
|
tfree(gammaj);
|
||||||
|
|
||||||
/* matrix = M set up */
|
/* matrix = M set up */
|
||||||
|
|
||||||
|
|
@ -203,10 +203,10 @@ int
|
||||||
int errflg, err, singular_row, singular_col;
|
int errflg, err, singular_row, singular_col;
|
||||||
double *elptr;
|
double *elptr;
|
||||||
|
|
||||||
rhs = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
rhs = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
irhs = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
irhs = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
solution = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
solution = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
isolution = (double *) malloc((unsigned) (sizeof(double)*(num+1)));
|
isolution = (double *) tmalloc((unsigned) (sizeof(double)*(num+1)));
|
||||||
|
|
||||||
othermatrix = spCreate(num,0,&errflg);
|
othermatrix = spCreate(num,0,&errflg);
|
||||||
|
|
||||||
|
|
@ -255,7 +255,8 @@ int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(rhs); free(solution);
|
tfree(rhs);
|
||||||
|
tfree(solution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inverse = M^{-1} set up */
|
/* inverse = M^{-1} set up */
|
||||||
|
|
@ -263,7 +264,7 @@ int
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"* Lossy line models\n");
|
fprintf(stdout,"* Lossy line models\n");
|
||||||
|
|
||||||
options = (char *) malloc((unsigned) 256);
|
options = (char *) tmalloc((unsigned) 256);
|
||||||
(void) strcpy(options,"rel=1.2 nocontrol");
|
(void) strcpy(options,"rel=1.2 nocontrol");
|
||||||
for (i=1;i<=num;i++) {
|
for (i=1;i<=num;i++) {
|
||||||
fprintf(stdout,".model mod%d_%s ltra %s r=%0.12g l=%0.12g g=%0.12g c=%0.12g len=%0.12g\n",
|
fprintf(stdout,".model mod%d_%s ltra %s r=%0.12g l=%0.12g g=%0.12g c=%0.12g len=%0.12g\n",
|
||||||
|
|
@ -326,15 +327,15 @@ int
|
||||||
|
|
||||||
fprintf(stdout,".ends %s\n",name);
|
fprintf(stdout,".ends %s\n",name);
|
||||||
|
|
||||||
free(tpeigenvalues);
|
tfree(tpeigenvalues);
|
||||||
for (i=1;i<=num;i++) {
|
for (i=1;i<=num;i++) {
|
||||||
free(matrix[i]);
|
tfree(matrix[i]);
|
||||||
free(inverse[i]);
|
tfree(inverse[i]);
|
||||||
}
|
}
|
||||||
free(matrix);
|
tfree(matrix);
|
||||||
free(inverse);
|
tfree(inverse);
|
||||||
free(name);
|
tfree(name);
|
||||||
free(options);
|
tfree(options);
|
||||||
|
|
||||||
return EXIT_NORMAL;
|
return EXIT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,9 @@ main(void) {
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
|
||||||
filename = (char *)malloc(1024);
|
filename = (char *)tmalloc(1024);
|
||||||
typeline = (char *)malloc(1024);
|
typeline = (char *)tmalloc(1024);
|
||||||
dataline = (char *)malloc(1024);
|
dataline = (char *)tmalloc(1024);
|
||||||
|
|
||||||
while(p == NULL) {
|
while(p == NULL) {
|
||||||
printf("name of process file (input): ");
|
printf("name of process file (input): ");
|
||||||
|
|
@ -107,7 +107,7 @@ main(void) {
|
||||||
}
|
}
|
||||||
if(*typeline == 0) break;
|
if(*typeline == 0) break;
|
||||||
if(strncmp("nm",typeline,2) == 0) {
|
if(strncmp("nm",typeline,2) == 0) {
|
||||||
ncur = (nmod *)malloc(sizeof(nmod));
|
ncur = (nmod *)tmalloc(sizeof(nmod));
|
||||||
ncur->nnext = NULL;
|
ncur->nnext = NULL;
|
||||||
ncur->nname = typeline;
|
ncur->nname = typeline;
|
||||||
*(typeline+3) = (char)NULL;
|
*(typeline+3) = (char)NULL;
|
||||||
|
|
@ -116,7 +116,7 @@ main(void) {
|
||||||
ncur->nnext = nlist;
|
ncur->nnext = nlist;
|
||||||
nlist = ncur;
|
nlist = ncur;
|
||||||
} else if(strncmp("pm",typeline,2) == 0) {
|
} else if(strncmp("pm",typeline,2) == 0) {
|
||||||
pcur = (pmod *)malloc(sizeof(pmod));
|
pcur = (pmod *)tmalloc(sizeof(pmod));
|
||||||
pcur->pnext = NULL;
|
pcur->pnext = NULL;
|
||||||
pcur->pname = typeline;
|
pcur->pname = typeline;
|
||||||
*(typeline+3) = (char)NULL;
|
*(typeline+3) = (char)NULL;
|
||||||
|
|
@ -125,7 +125,7 @@ main(void) {
|
||||||
pcur->pnext = plist;
|
pcur->pnext = plist;
|
||||||
plist = pcur;
|
plist = pcur;
|
||||||
} else if(strncmp("py",typeline,2) == 0) {
|
} else if(strncmp("py",typeline,2) == 0) {
|
||||||
ycur = (ymod *)malloc(sizeof(ymod));
|
ycur = (ymod *)tmalloc(sizeof(ymod));
|
||||||
ycur->ynext = NULL;
|
ycur->ynext = NULL;
|
||||||
ycur->yname = typeline;
|
ycur->yname = typeline;
|
||||||
*(typeline+3) = (char)NULL;
|
*(typeline+3) = (char)NULL;
|
||||||
|
|
@ -134,7 +134,7 @@ main(void) {
|
||||||
ycur->ynext = ylist;
|
ycur->ynext = ylist;
|
||||||
ylist = ycur;
|
ylist = ycur;
|
||||||
} else if(strncmp("du",typeline,2) == 0) {
|
} else if(strncmp("du",typeline,2) == 0) {
|
||||||
dcur = (dmod *)malloc(sizeof(dmod));
|
dcur = (dmod *)tmalloc(sizeof(dmod));
|
||||||
dcur->dnext = NULL;
|
dcur->dnext = NULL;
|
||||||
dcur->dname = typeline;
|
dcur->dname = typeline;
|
||||||
*(typeline+3) = (char)NULL;
|
*(typeline+3) = (char)NULL;
|
||||||
|
|
@ -143,7 +143,7 @@ main(void) {
|
||||||
dcur->dnext = dlist;
|
dcur->dnext = dlist;
|
||||||
dlist = dcur;
|
dlist = dcur;
|
||||||
} else if(strncmp("ml",typeline,2) == 0) {
|
} else if(strncmp("ml",typeline,2) == 0) {
|
||||||
mcur = (mmod *)malloc(sizeof(mmod));
|
mcur = (mmod *)tmalloc(sizeof(mmod));
|
||||||
mcur->mnext = NULL;
|
mcur->mnext = NULL;
|
||||||
mcur->mname = typeline;
|
mcur->mname = typeline;
|
||||||
*(typeline+3) = (char)NULL;
|
*(typeline+3) = (char)NULL;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount)
|
||||||
} else if (new_trial->flags & ISANABERRATION) {
|
} else if (new_trial->flags & ISANABERRATION) {
|
||||||
CKTpzReset(neighborhood);
|
CKTpzReset(neighborhood);
|
||||||
Aberr_Num += 1;
|
Aberr_Num += 1;
|
||||||
free(new_trial);
|
tfree(new_trial);
|
||||||
} else if (new_trial->flags & ISAMINIMA) {
|
} else if (new_trial->flags & ISAMINIMA) {
|
||||||
neighborhood[0] = NULL;
|
neighborhood[0] = NULL;
|
||||||
neighborhood[1] = new_trial;
|
neighborhood[1] = new_trial;
|
||||||
|
|
@ -645,7 +645,7 @@ CKTpzRunTrial(CKTcircuit *ckt, PZtrial **new_trialp, PZtrial **set)
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
p->flags |= ISAMINIMA;
|
p->flags |= ISAMINIMA;
|
||||||
free(new_trial);
|
tfree(new_trial);
|
||||||
*new_trialp = p;
|
*new_trialp = p;
|
||||||
repeat = 1;
|
repeat = 1;
|
||||||
} else if (p->flags & ISAROOT) {
|
} else if (p->flags & ISAROOT) {
|
||||||
|
|
@ -841,7 +841,7 @@ CKTpzVerify(PZtrial **set, PZtrial *new_trial)
|
||||||
if (t == Trials) {
|
if (t == Trials) {
|
||||||
Trials = t->next;
|
Trials = t->next;
|
||||||
}
|
}
|
||||||
free(t);
|
tfree(t);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (prev)
|
if (prev)
|
||||||
|
|
@ -899,7 +899,7 @@ clear_trials(int mode)
|
||||||
for (t = Trials; t; t = next) {
|
for (t = Trials; t; t = next) {
|
||||||
next = t->next;
|
next = t->next;
|
||||||
if (mode || !(t->flags & ISAROOT)) {
|
if (mode || !(t->flags & ISAROOT)) {
|
||||||
free(t);
|
tfree(t);
|
||||||
} else {
|
} else {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = t;
|
prev->next = t;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ B2temp(inModel,ckt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Size_Not_Found)
|
if (Size_Not_Found)
|
||||||
{ here->pParam = (struct bsim2SizeDependParam *)malloc(
|
{ here->pParam = (struct bsim2SizeDependParam *)tmalloc(
|
||||||
sizeof(struct bsim2SizeDependParam));
|
sizeof(struct bsim2SizeDependParam));
|
||||||
if (pLastKnot == NULL)
|
if (pLastKnot == NULL)
|
||||||
model->pSizeDependParamKnot = here->pParam;
|
model->pSizeDependParamKnot = here->pParam;
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ int Size_Not_Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Size_Not_Found)
|
if (Size_Not_Found)
|
||||||
{ pParam = (struct bsim3SizeDependParam *)malloc(
|
{ pParam = (struct bsim3SizeDependParam *)tmalloc(
|
||||||
sizeof(struct bsim3SizeDependParam));
|
sizeof(struct bsim3SizeDependParam));
|
||||||
if (pLastKnot == NULL)
|
if (pLastKnot == NULL)
|
||||||
model->pSizeDependParamKnot = pParam;
|
model->pSizeDependParamKnot = pParam;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ int Size_Not_Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Size_Not_Found)
|
if (Size_Not_Found)
|
||||||
{ pParam = (struct bsim3v1SizeDependParam *)malloc(
|
{ pParam = (struct bsim3v1SizeDependParam *)tmalloc(
|
||||||
sizeof(struct bsim3v1SizeDependParam));
|
sizeof(struct bsim3v1SizeDependParam));
|
||||||
if (pLastKnot == NULL)
|
if (pLastKnot == NULL)
|
||||||
model->pSizeDependParamKnot = pParam;
|
model->pSizeDependParamKnot = pParam;
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ int Size_Not_Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Size_Not_Found)
|
if (Size_Not_Found)
|
||||||
{ pParam = (struct BSIM3V2SizeDependParam *)malloc(
|
{ pParam = (struct BSIM3V2SizeDependParam *)tmalloc(
|
||||||
sizeof(struct BSIM3V2SizeDependParam));
|
sizeof(struct BSIM3V2SizeDependParam));
|
||||||
if (pLastKnot == NULL)
|
if (pLastKnot == NULL)
|
||||||
model->pSizeDependParamKnot = pParam;
|
model->pSizeDependParamKnot = pParam;
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ int Size_Not_Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Size_Not_Found)
|
if (Size_Not_Found)
|
||||||
{ pParam = (struct bsim4SizeDependParam *)malloc(
|
{ pParam = (struct bsim4SizeDependParam *)tmalloc(
|
||||||
sizeof(struct bsim4SizeDependParam));
|
sizeof(struct bsim4SizeDependParam));
|
||||||
if (pLastKnot == NULL)
|
if (pLastKnot == NULL)
|
||||||
model->pSizeDependParamKnot = pParam;
|
model->pSizeDependParamKnot = pParam;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
Error: no data saved for Sensitivity analysis; analysis not run
|
||||||
|
doAnalyses: not found
|
||||||
|
|
||||||
|
run simulation(s) aborted
|
||||||
|
|
||||||
Circuit: simple differential pair - CM and DM dc sensitivity
|
Circuit: simple differential pair - CM and DM dc sensitivity
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,17 +286,17 @@ Index time v(1)
|
||||||
1 6.000000e-13 1.800000e-04
|
1 6.000000e-13 1.800000e-04
|
||||||
2 7.422315e-13 2.226694e-04
|
2 7.422315e-13 2.226694e-04
|
||||||
3 1.026694e-12 3.080083e-04
|
3 1.026694e-12 3.080083e-04
|
||||||
4 1.595620e-12 4.786861e-04
|
4 1.595620e-12 4.786860e-04
|
||||||
5 2.733472e-12 8.200417e-04
|
5 2.733472e-12 8.200415e-04
|
||||||
6 5.009176e-12 1.502753e-03
|
6 5.009175e-12 1.502753e-03
|
||||||
7 9.560584e-12 2.868175e-03
|
7 9.560581e-12 2.868174e-03
|
||||||
8 1.866340e-11 5.599020e-03
|
8 1.866339e-11 5.599018e-03
|
||||||
9 3.686903e-11 1.106071e-02
|
9 3.686902e-11 1.106071e-02
|
||||||
10 7.328029e-11 2.198409e-02
|
10 7.328027e-11 2.198408e-02
|
||||||
11 1.332803e-10 3.998409e-02
|
11 1.332803e-10 3.998408e-02
|
||||||
12 1.932803e-10 5.798409e-02
|
12 1.932803e-10 5.798408e-02
|
||||||
13 2.532803e-10 7.598409e-02
|
13 2.532803e-10 7.598408e-02
|
||||||
14 3.132803e-10 9.398409e-02
|
14 3.132803e-10 9.398408e-02
|
||||||
15 3.732803e-10 1.119841e-01
|
15 3.732803e-10 1.119841e-01
|
||||||
16 4.332803e-10 1.299841e-01
|
16 4.332803e-10 1.299841e-01
|
||||||
17 4.932803e-10 1.479841e-01
|
17 4.932803e-10 1.479841e-01
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
Error: no data saved for A.C. Small signal analysis; analysis not run
|
||||||
|
doAnalyses: not found
|
||||||
|
|
||||||
|
run simulation(s) aborted
|
||||||
|
|
||||||
Circuit: * Resistive partition with different ratios for AC/DC (Print V(2))
|
Circuit: * Resistive partition with different ratios for AC/DC (Print V(2))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue