wrap tmalloc MALLOC etc, into two macros TMALLOC and TREALLOC
This commit is contained in:
parent
ea8d250999
commit
7b3960506f
|
|
@ -1,3 +1,8 @@
|
|||
2010-10-28 Robert Larice
|
||||
* src/**/* :
|
||||
wrap tmalloc MALLOC etc, into two macros TMALLOC and TREALLOC
|
||||
add casts to those macros to silence type conversion warnings
|
||||
|
||||
2010-10-28 Robert Larice
|
||||
* src/frontend/commands.c ,
|
||||
* src/frontend/control.c :
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ DOPparam(int param, IFvalue *value, void *inCard)
|
|||
case DOP_DOMAIN:
|
||||
if ( !card->DOPdomainsGiven ) {
|
||||
card->DOPnumDomains = value->v.numValue;
|
||||
card->DOPdomains = (int *)tmalloc(value->v.numValue * sizeof(int));
|
||||
card->DOPdomains = TMALLOC(int, value->v.numValue);
|
||||
for ( i=0; i < card->DOPnumDomains; i++ ) {
|
||||
card->DOPdomains[i] = value->v.vec.iVec[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ DBgetData(struct plot *plot, char *name, int lengthWanted)
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
data = (double *) tmalloc(sizeof (double) * v->v_length);
|
||||
data = TMALLOC(double, v->v_length);
|
||||
if (isreal(v)) {
|
||||
bcopy(v->v_realdata, data, sizeof (double) * v->v_length);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ char *prompt(FILE *fp)
|
|||
return 0;
|
||||
n = strlen(buf) - 1;
|
||||
buf[n] = '\0'; /* fgets leaves the \n */
|
||||
p = (char *) tmalloc(n + 1);
|
||||
p = TMALLOC(char, n + 1);
|
||||
strcpy(p, buf);
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,8 +112,7 @@ ft_getSaves(struct save_info **savesp)
|
|||
if (!count)
|
||||
return (0);
|
||||
|
||||
*savesp = array = (struct save_info *)
|
||||
tmalloc(sizeof (struct save_info) * count);
|
||||
*savesp = array = TMALLOC(struct save_info, count);
|
||||
|
||||
for (d = dbs; d; d = d->db_next)
|
||||
if (d->db_type == DB_SAVE) {
|
||||
|
|
|
|||
|
|
@ -180,11 +180,9 @@ com_compose(wordlist *wl)
|
|||
for (i = 0, blocksize = 1; i < dim - 1; i++)
|
||||
blocksize *= dims[i];
|
||||
if (realflag)
|
||||
data = (double *) tmalloc(sizeof (double) * (length *
|
||||
blocksize));
|
||||
data = TMALLOC(double, length * blocksize);
|
||||
else
|
||||
cdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * (length *
|
||||
blocksize));
|
||||
cdata = TMALLOC(ngcomplex_t, length * blocksize);
|
||||
|
||||
/* Now copy all the data over... If the sizes are too small
|
||||
* then the extra elements are left as 0.
|
||||
|
|
@ -416,7 +414,7 @@ com_compose(wordlist *wl)
|
|||
}
|
||||
if (lingiven) {
|
||||
/* Create a linear sweep... */
|
||||
data = (double *) tmalloc(sizeof (double) * (int) lin);
|
||||
data = TMALLOC(double, (int) lin);
|
||||
if (stepgiven && startgiven && stopgiven) {
|
||||
if (step != (stop - start) / lin * (reverse ?
|
||||
-1 : 1)) {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ com_display(wordlist *wl)
|
|||
return;
|
||||
}
|
||||
out_printf("Here are the vectors currently active:\n\n");
|
||||
dvs = (struct dvec **) tmalloc(len * sizeof(struct dvec *));
|
||||
dvs = TMALLOC(struct dvec *, len);
|
||||
for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++)
|
||||
dvs[i] = d;
|
||||
if (!cp_getvar("nosort", CP_BOOL, NULL))
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ com_fft(wordlist *wl)
|
|||
fpts = size/2;
|
||||
|
||||
/* window functions - should have an average of one */
|
||||
win = (double *) tmalloc(tlen * sizeof (double));
|
||||
win = TMALLOC(double, tlen);
|
||||
{
|
||||
char window[BSIZE_SP];
|
||||
double maxt = time[tlen-1];
|
||||
|
|
@ -188,7 +188,7 @@ com_fft(wordlist *wl)
|
|||
plot_cur->pl_name = copy("Spectrum");
|
||||
plot_cur->pl_date = copy(datestring( ));
|
||||
|
||||
freq = (double *) tmalloc(fpts * sizeof(double));
|
||||
freq = TMALLOC(double, fpts);
|
||||
f = alloc(struct dvec);
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
|
|
@ -201,11 +201,11 @@ com_fft(wordlist *wl)
|
|||
for (i = 0; i<fpts; i++) freq[i] = i*1.0/span*tlen/size;
|
||||
|
||||
|
||||
tdvec = (double **) tmalloc(ngood * sizeof(double *));
|
||||
fdvec = (ngcomplex_t **) tmalloc(ngood * sizeof(ngcomplex_t *));
|
||||
tdvec = TMALLOC(double *, ngood);
|
||||
fdvec = TMALLOC(ngcomplex_t *, ngood);
|
||||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata; /* real input data */
|
||||
fdvec[i] = (ngcomplex_t *) tmalloc(fpts * sizeof(ngcomplex_t)); /* complex output data */
|
||||
fdvec[i] = TMALLOC(ngcomplex_t, fpts); /* complex output data */
|
||||
f = alloc(struct dvec);
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
|
|
@ -222,8 +222,8 @@ com_fft(wordlist *wl)
|
|||
printf("FFT: Time span: %g s, input length: %d, zero padding: %d\n", span, size, size-tlen);
|
||||
printf("FFT: Freq. resolution: %g Hz, output length: %d\n", 1.0/span*tlen/size, fpts);
|
||||
|
||||
reald = (double*)tmalloc(size*sizeof(double));
|
||||
imagd = (double*)tmalloc(size*sizeof(double));
|
||||
reald = TMALLOC(double, size);
|
||||
imagd = TMALLOC(double, size);
|
||||
for (i = 0; i<ngood; i++) {
|
||||
for (j = 0; j < tlen; j++){
|
||||
reald[j] = tdvec[i][j]*win[j];
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ com_hardcopy(wordlist *wl)
|
|||
outmenuprompt("which variable ? ");
|
||||
if ((buf2 = prompt(cp_in)) == (char *) -1) /* XXXX Sick */
|
||||
return;
|
||||
wl = (struct wordlist *) tmalloc(sizeof(struct wordlist));
|
||||
wl = TMALLOC(struct wordlist, 1);
|
||||
wl->wl_word = buf2;
|
||||
wl->wl_next = NULL;
|
||||
wl = process(wl);
|
||||
|
|
|
|||
|
|
@ -166,9 +166,9 @@ com_let(wordlist *wl)
|
|||
}
|
||||
|
||||
if (isreal(t))
|
||||
n->v_realdata = (double *) tmalloc(n->v_length * sizeof(double));
|
||||
n->v_realdata = TMALLOC(double, n->v_length);
|
||||
else
|
||||
n->v_compdata = (ngcomplex_t *) tmalloc(n->v_length * sizeof(ngcomplex_t));
|
||||
n->v_compdata = TMALLOC(ngcomplex_t, n->v_length);
|
||||
newvec = 1;
|
||||
vec_new(n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -786,9 +786,9 @@ static void measure_rms_integral(
|
|||
}
|
||||
|
||||
/* Allocate buffers for calculation. */
|
||||
x = (double *) tmalloc(xScale->v_length * sizeof(double));
|
||||
y = (double *) tmalloc(xScale->v_length * sizeof(double));
|
||||
width = (double *) tmalloc((xScale->v_length + 1) * sizeof(double));
|
||||
x = TMALLOC(double, xScale->v_length);
|
||||
y = TMALLOC(double, xScale->v_length);
|
||||
width = TMALLOC(double, xScale->v_length + 1);
|
||||
|
||||
xy_size = 0 ;
|
||||
toVal = -1 ;
|
||||
|
|
@ -1394,8 +1394,8 @@ get_measure2(
|
|||
{
|
||||
// trig parameters
|
||||
MEASUREPTR measTrig, measTarg;
|
||||
measTrig = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
measTarg = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
measTrig = TMALLOC(struct measure, 1);
|
||||
measTarg = TMALLOC(struct measure, 1);
|
||||
|
||||
measTrig->m_analysis = measTarg->m_analysis = mAnalysis;
|
||||
|
||||
|
|
@ -1463,8 +1463,8 @@ get_measure2(
|
|||
case AT_FIND:
|
||||
{
|
||||
MEASUREPTR meas, measFind;
|
||||
meas = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
measFind = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
meas = TMALLOC(struct measure, 1);
|
||||
measFind = TMALLOC(struct measure, 1);
|
||||
|
||||
meas->m_analysis = measFind->m_analysis = mAnalysis;
|
||||
|
||||
|
|
@ -1519,7 +1519,7 @@ get_measure2(
|
|||
case AT_WHEN:
|
||||
{
|
||||
MEASUREPTR meas;
|
||||
meas = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
meas = TMALLOC(struct measure, 1);
|
||||
meas->m_analysis = mAnalysis;
|
||||
if (measure_parse_when(meas, words, errbuf) ==0) {
|
||||
measure_errMessage(mName, mFunction, "WHEN", errbuf, autocheck);
|
||||
|
|
@ -1549,7 +1549,7 @@ get_measure2(
|
|||
{
|
||||
// trig parameters
|
||||
MEASUREPTR meas;
|
||||
meas = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
meas = TMALLOC(struct measure, 1);
|
||||
meas->m_analysis = mAnalysis;
|
||||
if (measure_parse_trigtarg(meas, words , NULL, "trig", errbuf)==0) {
|
||||
measure_errMessage(mName, mFunction, "TRIG", errbuf, autocheck);
|
||||
|
|
@ -1582,7 +1582,7 @@ get_measure2(
|
|||
{
|
||||
// trig parameters
|
||||
MEASUREPTR meas;
|
||||
meas = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
meas = TMALLOC(struct measure, 1);
|
||||
|
||||
meas->m_analysis = mAnalysis;
|
||||
|
||||
|
|
@ -1619,7 +1619,7 @@ get_measure2(
|
|||
{
|
||||
// trig parameters
|
||||
MEASUREPTR measTrig;
|
||||
measTrig = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
measTrig = TMALLOC(struct measure, 1);
|
||||
measTrig->m_analysis = mAnalysis;
|
||||
if (measure_parse_trigtarg(measTrig, words , NULL, "trig", errbuf)==0) {
|
||||
measure_errMessage(mName, mFunction, "TRIG", errbuf, autocheck);
|
||||
|
|
@ -1661,7 +1661,7 @@ get_measure2(
|
|||
{
|
||||
double minValue, maxValue;
|
||||
MEASUREPTR measTrig;
|
||||
measTrig = (struct measure*)tmalloc(sizeof(struct measure));
|
||||
measTrig = TMALLOC(struct measure, 1);
|
||||
measTrig->m_analysis = mAnalysis;
|
||||
if (measure_parse_trigtarg(measTrig, words , NULL, "trig", errbuf)==0) {
|
||||
measure_errMessage(mName, mFunction, "TRIG", errbuf, autocheck);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void com_sysinfo(wordlist *wl)
|
|||
int errorcode;
|
||||
TesSystemInfo* info;
|
||||
|
||||
info = (TesSystemInfo*)tmalloc(sizeof(TesSystemInfo));
|
||||
info = TMALLOC(TesSystemInfo, 1);
|
||||
|
||||
errorcode = tesCreateSystemInfo(info);
|
||||
if (errorcode)
|
||||
|
|
@ -457,7 +457,7 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) {
|
|||
}
|
||||
|
||||
RegQueryValueExA(hkBaseCPU,"ProcessorNameString",0,0,NULL,&dwLen);
|
||||
freeStr = procStr = (char*) tmalloc(dwLen+1);
|
||||
freeStr = procStr = TMALLOC(char, dwLen + 1);
|
||||
RegQueryValueExA(hkBaseCPU,"ProcessorNameString",0,0,(LPBYTE)procStr,&dwLen);
|
||||
procStr[dwLen] = '\0';
|
||||
while (*procStr == ' ') procStr++;
|
||||
|
|
|
|||
|
|
@ -164,14 +164,12 @@ savetree(struct pnode *pn)
|
|||
pn->pn_value->v_flags = d->v_flags;
|
||||
pn->pn_value->v_plot = d->v_plot;
|
||||
if (isreal(d)) {
|
||||
pn->pn_value->v_realdata = (double *)
|
||||
tmalloc(sizeof (double) * d->v_length);
|
||||
pn->pn_value->v_realdata = TMALLOC(double, d->v_length);
|
||||
bcopy(d->v_realdata,
|
||||
pn->pn_value->v_realdata,
|
||||
sizeof (double) * d->v_length);
|
||||
} else {
|
||||
pn->pn_value->v_compdata = (ngcomplex_t *)
|
||||
tmalloc(sizeof(ngcomplex_t) * d->v_length);
|
||||
pn->pn_value->v_compdata = TMALLOC(ngcomplex_t, d->v_length);
|
||||
bcopy(d->v_compdata,
|
||||
pn->pn_value->v_compdata,
|
||||
sizeof(ngcomplex_t) * d->v_length);
|
||||
|
|
|
|||
|
|
@ -915,10 +915,10 @@ com_alter_common(wordlist *wl, int do_model)
|
|||
if(argument[i]!='\0'){
|
||||
/* We found '=' */
|
||||
eqfound = TRUE;
|
||||
arglist = (char**)tmalloc(4*sizeof(char*));
|
||||
arglist = TMALLOC(char*, 4);
|
||||
arglist[3] = NULL;
|
||||
arglist[0] = (char*)tmalloc(i + 1);
|
||||
arglist[2] = (char*)tmalloc(strlen(&argument[i+1]) + 1);
|
||||
arglist[0] = TMALLOC(char, i + 1);
|
||||
arglist[2] = TMALLOC(char, strlen(&argument[i + 1]) + 1);
|
||||
/* copy argument */
|
||||
strncpy(arglist[0],argument,i);
|
||||
arglist[0][i] = '\0';
|
||||
|
|
@ -981,7 +981,7 @@ com_alter_common(wordlist *wl, int do_model)
|
|||
}
|
||||
/* add the '=' */
|
||||
/* create wordlist with '=' */
|
||||
wleq = (wordlist*)tmalloc(sizeof(wordlist));
|
||||
wleq = TMALLOC(wordlist, 1);
|
||||
wleq->wl_word = copy("=");
|
||||
/* add the last element (the value of the param - value pair) */
|
||||
wleq->wl_next = wlin;
|
||||
|
|
@ -1068,17 +1068,17 @@ com_alter_common(wordlist *wl, int do_model)
|
|||
if(eq(words->wl_word, "[")) words = words->wl_next;
|
||||
xsbuf = wl_flatten(words);
|
||||
/* fprintf(cp_err, "Chain converted %s \n",xsbuf); */
|
||||
dv=(struct dvec *)MALLOC(sizeof(struct dvec));
|
||||
dv = TMALLOC(struct dvec, 1);
|
||||
dv->v_name = copy("real vector");
|
||||
type &= IF_VARTYPES;
|
||||
if (type == IF_REALVEC) {
|
||||
list = (double *)MALLOC(sizeof(double));
|
||||
list = TMALLOC(double, 1);
|
||||
tmp = INPevaluate(&xsbuf,&error,1);
|
||||
while (error == 0)
|
||||
{
|
||||
/*printf(" returning vector value %g\n",tmp); */
|
||||
i++;
|
||||
list=(double *)REALLOC((char *)list,i*sizeof(double));
|
||||
list=TREALLOC(double, list, i);
|
||||
*(list+i-1) = tmp;
|
||||
tmp = INPevaluate(&xsbuf,&error,1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ void SaveText(GRAPH *graph, char *text, int x, int y)
|
|||
|
||||
struct _keyed *keyed;
|
||||
|
||||
keyed = (struct _keyed *) tmalloc(sizeof(struct _keyed));
|
||||
keyed = TMALLOC(struct _keyed, 1);
|
||||
|
||||
if (!graph->keyed) {
|
||||
graph->keyed = keyed;
|
||||
|
|
@ -363,7 +363,7 @@ void SaveText(GRAPH *graph, char *text, int x, int y)
|
|||
graph->keyed = keyed;
|
||||
}
|
||||
|
||||
keyed->text = (char*) tmalloc(strlen(text) + 1);
|
||||
keyed->text = TMALLOC(char, strlen(text) + 1);
|
||||
strcpy(keyed->text, text);
|
||||
|
||||
keyed->x = x;
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ doop(char what,
|
|||
free1 = TRUE;
|
||||
if (isreal(v1)) {
|
||||
ld = 0.0;
|
||||
d1 = (double *) tmalloc(length * sizeof (double));
|
||||
d1 = TMALLOC(double, length);
|
||||
for (i = 0; i < v1->v_length; i++)
|
||||
d1[i] = v1->v_realdata[i];
|
||||
if (i > 0)
|
||||
|
|
@ -234,7 +234,7 @@ doop(char what,
|
|||
} else {
|
||||
realpart(&lc) = 0.0;
|
||||
imagpart(&lc) = 0.0;
|
||||
c1 = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
|
||||
c1 = TMALLOC(ngcomplex_t, length);
|
||||
for (i = 0; i < v1->v_length; i++)
|
||||
c1[i] = v1->v_compdata[i];
|
||||
if (i > 0)
|
||||
|
|
@ -251,7 +251,7 @@ doop(char what,
|
|||
free2 = TRUE;
|
||||
if (isreal(v2)) {
|
||||
ld = 0.0;
|
||||
d2 = (double *) tmalloc(length * sizeof (double));
|
||||
d2 = TMALLOC(double, length);
|
||||
for (i = 0; i < v2->v_length; i++)
|
||||
d2[i] = v2->v_realdata[i];
|
||||
if (i > 0)
|
||||
|
|
@ -261,7 +261,7 @@ doop(char what,
|
|||
} else {
|
||||
realpart(&lc) = 0.0;
|
||||
imagpart(&lc) = 0.0;
|
||||
c2 = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
|
||||
c2 = TMALLOC(ngcomplex_t, length);
|
||||
for (i = 0; i < v2->v_length; i++)
|
||||
c2[i] = v2->v_compdata[i];
|
||||
if (i > 0)
|
||||
|
|
@ -601,9 +601,9 @@ op_range(struct pnode *arg1, struct pnode *arg2)
|
|||
res->v_dims[0] = len;
|
||||
|
||||
if (isreal(res))
|
||||
res->v_realdata = (double *) tmalloc(sizeof (double) * len);
|
||||
res->v_realdata = TMALLOC(double, len);
|
||||
else
|
||||
res->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * len);
|
||||
res->v_compdata = TMALLOC(ngcomplex_t, len);
|
||||
|
||||
/* Toss in the data */
|
||||
|
||||
|
|
@ -752,9 +752,9 @@ op_ind(struct pnode *arg1, struct pnode *arg2)
|
|||
}
|
||||
|
||||
if (isreal(res))
|
||||
res->v_realdata = (double *) tmalloc(sizeof (double) * length);
|
||||
res->v_realdata = TMALLOC(double, length);
|
||||
else
|
||||
res->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * length);
|
||||
res->v_compdata = TMALLOC(ngcomplex_t, length);
|
||||
|
||||
/* And toss in the new data */
|
||||
for (j = 0; j < up - down + 1; j++) {
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ fourier(wordlist *wl, struct plot *current_plot)
|
|||
}
|
||||
fundfreq = *ff;
|
||||
|
||||
freq = (double *) tmalloc(nfreqs * sizeof (double));
|
||||
mag = (double *) tmalloc(nfreqs * sizeof (double));
|
||||
phase = (double *) tmalloc(nfreqs * sizeof (double));
|
||||
nmag = (double *) tmalloc(nfreqs * sizeof (double));
|
||||
nphase = (double *) tmalloc(nfreqs * sizeof (double));
|
||||
freq = TMALLOC(double, nfreqs);
|
||||
mag = TMALLOC(double, nfreqs);
|
||||
phase = TMALLOC(double, nfreqs);
|
||||
nmag = TMALLOC(double, nfreqs);
|
||||
nphase = TMALLOC(double, nfreqs);
|
||||
|
||||
wl = wl->wl_next;
|
||||
names = ft_getpnames(wl, TRUE);
|
||||
|
|
@ -110,10 +110,8 @@ fourier(wordlist *wl, struct plot *current_plot)
|
|||
|
||||
if (polydegree) {
|
||||
/* Build the grid... */
|
||||
grid = (double *) tmalloc(fourgridsize *
|
||||
sizeof (double));
|
||||
stuff = (double *) tmalloc(fourgridsize *
|
||||
sizeof (double));
|
||||
grid = TMALLOC(double, fourgridsize);
|
||||
stuff = TMALLOC(double, fourgridsize);
|
||||
dp = ft_minmax(time, TRUE);
|
||||
|
||||
/* Now get the last fund freq... */
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ findglobalsubject(char *subject)
|
|||
for (dict = hlp_filelist; *dict && **dict; dict++) {
|
||||
fpos = findsubject(*dict, subject);
|
||||
if (fpos != -1) {
|
||||
place = (fplace *) tmalloc(sizeof(fplace));
|
||||
place = TMALLOC(fplace, 1);
|
||||
place->fpos = fpos;
|
||||
place->filename = copy(*dict);
|
||||
place->fp = hlp_fopen(*dict);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ sortlist(toplink **tlp)
|
|||
num++;
|
||||
if (!num)
|
||||
return;
|
||||
vec = (toplink **) tmalloc(sizeof (toplink *) * num);
|
||||
vec = TMALLOC(toplink *, num);
|
||||
for (tl = *tlp, i = 0; tl; tl = tl->next, i++)
|
||||
vec[i] = tl;
|
||||
(void) qsort(vec, num, sizeof (toplink *), sortcmp);
|
||||
|
|
@ -188,7 +188,7 @@ static toplink *getsubtoplink(char **ss)
|
|||
if ((tmp =strchr(s, ':'))) {
|
||||
tl->place = alloc(fplace);
|
||||
tl->place->filename = strncpy(
|
||||
(char*) tmalloc(sizeof (char) * (tmp - s + 1)),
|
||||
TMALLOC(char, tmp - s + 1),
|
||||
s, (tmp - s));
|
||||
tl->place->filename[tmp - s] = '\0';
|
||||
strtolower(tl->place->filename);
|
||||
|
|
@ -354,7 +354,7 @@ copy_fplace(fplace *place)
|
|||
{
|
||||
fplace *newplace;
|
||||
|
||||
newplace = (fplace *) tmalloc(sizeof(fplace));
|
||||
newplace = TMALLOC(fplace, 1);
|
||||
newplace->filename = copy(place->filename);
|
||||
newplace->fpos = place->fpos;
|
||||
newplace->fp = place->fp;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ hlp_xdisplay(topic *top)
|
|||
top->titlewidget, buttonargs, XtNumber(buttonargs));
|
||||
XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) delete, top);
|
||||
|
||||
buf = (char*) tmalloc(80 * top->numlines + 100);
|
||||
buf = TMALLOC(char, 80 * top->numlines + 100);
|
||||
buf[0] = '\0';
|
||||
for (wl = top->text; wl; wl = wl->wl_next) {
|
||||
sputline(buf, wl->wl_word);
|
||||
|
|
@ -164,7 +164,7 @@ hlp_xdisplay(topic *top)
|
|||
commandWidgetClass, top->subboxwidget, buttonargs,
|
||||
XtNumber(buttonargs));
|
||||
/* core leak XXX */
|
||||
hand = (handle *) tmalloc(sizeof (handle));
|
||||
hand = TMALLOC(handle, 1);
|
||||
hand->result = tl;
|
||||
hand->parent = top;
|
||||
XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) newtopic, hand);
|
||||
|
|
@ -196,7 +196,7 @@ hlp_xdisplay(topic *top)
|
|||
XtSetArg(buttonargs[0], XtNlabel, tl->button.text);
|
||||
buttonwidget = XtCreateManagedWidget(tl->button.text,
|
||||
commandWidgetClass, top->seeboxwidget, buttonargs, 1);
|
||||
hand = (handle *) tmalloc(sizeof (handle));
|
||||
hand = TMALLOC(handle, 1);
|
||||
/* core leak XXX */
|
||||
hand->result = tl;
|
||||
hand->parent = top;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ GRAPH *graph)
|
|||
if (!screenflag)
|
||||
#endif
|
||||
|
||||
graph->devdep = (GLdevdep*) tmalloc(sizeof(GLdevdep));
|
||||
graph->devdep = TMALLOC(GLdevdep, 1);
|
||||
DEVDEP(graph).lastlinestyle = -1;
|
||||
DEVDEP(graph).lastx = -1;
|
||||
DEVDEP(graph).lasty = -1;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ readline(FILE *fd)
|
|||
strptr = NULL;
|
||||
strlen = 0;
|
||||
memlen = STRGROW;
|
||||
strptr = (char*) tmalloc(memlen);
|
||||
strptr = TMALLOC(char, memlen);
|
||||
memlen -= 1; /* Save constant -1's in while loop */
|
||||
while((c = getc(fd)) != EOF) {
|
||||
if (strlen == 0 && (c == '\t' || c == ' ')) /* Leading spaces away */
|
||||
|
|
@ -139,7 +139,7 @@ readline(FILE *fd)
|
|||
strlen++;
|
||||
if( strlen >= memlen ) {
|
||||
memlen += STRGROW;
|
||||
if( !(strptr = (char*) trealloc(strptr, (memlen + 1)*sizeof(char)))) {
|
||||
if( !(strptr = TREALLOC(char, strptr, memlen + 1))) {
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ readline(FILE *fd)
|
|||
}
|
||||
// strptr[strlen] = '\0';
|
||||
/* Trim the string */
|
||||
strptr = (char*) trealloc(strptr, (strlen + 1)*sizeof(char));
|
||||
strptr = TREALLOC(char, strptr, strlen + 1);
|
||||
strptr[strlen] = '\0';
|
||||
return (strptr);
|
||||
}
|
||||
|
|
@ -400,7 +400,7 @@ inp_add_control_section( struct line *deck, int *line_number ) {
|
|||
found_run = TRUE;
|
||||
}
|
||||
if ( cp_getvar( "rawfile", CP_STRING, rawfile ) ) {
|
||||
line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 );
|
||||
line = TMALLOC(char, strlen("write") + strlen(rawfile) + 2);
|
||||
sprintf(line, "write %s", rawfile);
|
||||
newcard = create_new_card( line, line_number );
|
||||
prev_card->li_next = newcard;
|
||||
|
|
@ -419,7 +419,7 @@ inp_add_control_section( struct line *deck, int *line_number ) {
|
|||
newcard->li_next = prev_card;
|
||||
|
||||
if ( cp_getvar( "rawfile", CP_STRING, rawfile ) ) {
|
||||
line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 );
|
||||
line = TMALLOC(char, strlen("write") + strlen(rawfile) + 2);
|
||||
sprintf(line, "write %s", rawfile);
|
||||
prev_card = deck->li_next;
|
||||
newcard = create_new_card( line, line_number );
|
||||
|
|
@ -486,10 +486,10 @@ inp_fix_macro_param_func_paren_io( struct line *begin_card ) {
|
|||
while( !isspace(*str_ptr) ) str_ptr++;
|
||||
|
||||
if ( ciprefix( ".macro", card->li_line ) ) {
|
||||
new_str = (char*) tmalloc( strlen(".subckt") + strlen(str_ptr) + 1 );
|
||||
new_str = TMALLOC(char, strlen(".subckt") + strlen(str_ptr) + 1);
|
||||
sprintf( new_str, ".subckt%s", str_ptr );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(".ends") + strlen(str_ptr) + 1 );
|
||||
new_str = TMALLOC(char, strlen(".ends") + strlen(str_ptr) + 1);
|
||||
sprintf( new_str, ".ends%s", str_ptr );
|
||||
}
|
||||
|
||||
|
|
@ -751,8 +751,8 @@ comment_out_unused_subckt_models( struct line *start_card , int no_of_lines)
|
|||
/* generate arrays of *char for subckt or model names. Start
|
||||
with 1000, but increase, if number of lines in deck is larger */
|
||||
if (no_of_lines < 1000) no_of_lines = 1000;
|
||||
used_subckt_names = (char**)tmalloc(no_of_lines*sizeof(char*));
|
||||
used_model_names = (char**)tmalloc(no_of_lines*sizeof(char*));
|
||||
used_subckt_names = TMALLOC(char*, no_of_lines);
|
||||
used_model_names = TMALLOC(char*, no_of_lines);
|
||||
|
||||
for ( card = start_card; card != NULL; card = card->li_next ) {
|
||||
if ( ciprefix( ".model", card->li_line ) ) has_models = TRUE;
|
||||
|
|
@ -1005,19 +1005,19 @@ inp_fix_ternary_operator_str( char *line )
|
|||
|
||||
if ( end_str != NULL ) {
|
||||
if ( beg_str != NULL ) {
|
||||
new_str = (char*) tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 );
|
||||
new_str = TMALLOC(char, strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5);
|
||||
sprintf( new_str, "%sternary_fcn(%s,%s,%s)%s", beg_str, conditional, if_str, else_str, end_str );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 );
|
||||
new_str = TMALLOC(char, strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5);
|
||||
sprintf( new_str, "ternary_fcn(%s,%s,%s)%s", conditional, if_str, else_str, end_str );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( beg_str != NULL ) {
|
||||
new_str = (char*) tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 );
|
||||
new_str = TMALLOC(char, strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5);
|
||||
sprintf( new_str, "%sternary_fcn(%s,%s,%s)", beg_str, conditional, if_str, else_str );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 );
|
||||
new_str = TMALLOC(char, strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5);
|
||||
sprintf( new_str, "ternary_fcn(%s,%s,%s)", conditional, if_str, else_str );
|
||||
}
|
||||
}
|
||||
|
|
@ -1115,7 +1115,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
if ( call_depth == 0 && line_count == 0 ) {
|
||||
line_count++;
|
||||
if ( fgets( big_buff, 5000, fp ) ) {
|
||||
/* buffer = (char*) tmalloc( strlen(big_buff) + 1 );
|
||||
/* buffer = TMALLOC(char, strlen(big_buff) + 1);
|
||||
strcpy(buffer, big_buff); */
|
||||
buffer = copy(big_buff);
|
||||
}
|
||||
|
|
@ -1137,7 +1137,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
break;
|
||||
}
|
||||
else if(ipc_status == IPC_STATUS_OK) {
|
||||
buffer = (char *) tmalloc(strlen(ipc_buffer) + 3);
|
||||
buffer = TMALLOC(char, strlen(ipc_buffer) + 3);
|
||||
strcpy(buffer, ipc_buffer);
|
||||
strcat(buffer, "\n");
|
||||
}
|
||||
|
|
@ -1375,7 +1375,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
}
|
||||
|
||||
if ( shell_eol_continuation ) {
|
||||
char *new_buffer = (char*) tmalloc( strlen(buffer) + 2);
|
||||
char *new_buffer = TMALLOC(char, strlen(buffer) + 2);
|
||||
sprintf( new_buffer, "+%s", buffer );
|
||||
|
||||
tfree(buffer);
|
||||
|
|
@ -1410,7 +1410,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
|
||||
if ( call_depth == 0 && found_end == TRUE) {
|
||||
if ( global == NULL ) {
|
||||
global = (char*) tmalloc( strlen(".global gnd") + 1 );
|
||||
global = TMALLOC(char, strlen(".global gnd") + 1);
|
||||
sprintf( global, ".global gnd" );
|
||||
}
|
||||
global_card = alloc(struct line);
|
||||
|
|
@ -1507,7 +1507,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
end->li_next = alloc(struct line); /* create next card */
|
||||
end = end->li_next; /* point to next card */
|
||||
|
||||
buffer = (char*) tmalloc( strlen( ".end" ) + 1 );
|
||||
buffer = TMALLOC(char, strlen( ".end" ) + 1);
|
||||
sprintf( buffer, ".end" );
|
||||
|
||||
/* now put buffer into li */
|
||||
|
|
@ -1565,7 +1565,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
|||
}
|
||||
|
||||
/* create buffer and write last and current line into it. */
|
||||
buffer = (char*) tmalloc(strlen(prev->li_line) + strlen(s) + 2);
|
||||
buffer = TMALLOC(char, strlen(prev->li_line) + strlen(s) + 2);
|
||||
(void) sprintf(buffer, "%s %s", prev->li_line, s + 1);
|
||||
|
||||
s = prev->li_line;
|
||||
|
|
@ -1893,7 +1893,7 @@ inp_fix_subckt( char *s )
|
|||
if ( new_str == NULL ) new_str = strdup(c->li_line);
|
||||
else {
|
||||
str = new_str;
|
||||
new_str = (char*) tmalloc( strlen(str) + strlen(c->li_line) + 2 );
|
||||
new_str = TMALLOC(char, strlen(str) + strlen(c->li_line) + 2);
|
||||
sprintf( new_str, "%s %s", str, c->li_line );
|
||||
tfree(str);
|
||||
}
|
||||
|
|
@ -1904,7 +1904,7 @@ inp_fix_subckt( char *s )
|
|||
}
|
||||
|
||||
/* create buffer and insert params: */
|
||||
buffer = (char*) tmalloc( strlen(s) + 9 + strlen(new_str) + 1 );
|
||||
buffer = TMALLOC(char, strlen(s) + 9 + strlen(new_str) + 1);
|
||||
sprintf( buffer, "%s params: %s", s, new_str );
|
||||
|
||||
tfree(s); tfree(new_str);
|
||||
|
|
@ -1922,7 +1922,7 @@ inp_remove_ws( char *s )
|
|||
char *buffer, *curr;
|
||||
bool is_expression = FALSE;
|
||||
|
||||
big_buff = (char*) tmalloc( strlen(s) + 1 );
|
||||
big_buff = TMALLOC(char, strlen(s) + 1);
|
||||
curr = s;
|
||||
|
||||
while ( *curr != '\0' ) {
|
||||
|
|
@ -2213,7 +2213,7 @@ inp_fix_inst_line( char *inst_line,
|
|||
}
|
||||
|
||||
for ( i = 0; i < num_subckt_params; i++ ) {
|
||||
new_line = (char*) tmalloc( strlen( curr_line ) + strlen( subckt_param_values[i] ) + 2 );
|
||||
new_line = TMALLOC(char, strlen( curr_line ) + strlen( subckt_param_values[i] ) + 2);
|
||||
sprintf( new_line, "%s %s", curr_line, subckt_param_values[i] );
|
||||
|
||||
tfree( curr_line );
|
||||
|
|
@ -2259,11 +2259,11 @@ inp_fix_subckt_multiplier( struct line *subckt_card,
|
|||
num_subckt_params = num_subckt_params + 1;
|
||||
|
||||
if ( !strstr( subckt_card->li_line, "params:" ) ) {
|
||||
new_str = (char*) tmalloc( strlen( subckt_card->li_line ) + 13 );
|
||||
new_str = TMALLOC(char, strlen( subckt_card->li_line ) + 13);
|
||||
sprintf( new_str, "%s params: m=1", subckt_card->li_line );
|
||||
subckt_w_params[num_subckt_w_params++] = get_subckt_model_name( subckt_card->li_line );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen( subckt_card->li_line ) + 5 );
|
||||
new_str = TMALLOC(char, strlen( subckt_card->li_line ) + 5);
|
||||
sprintf( new_str, "%s m=1", subckt_card->li_line );
|
||||
}
|
||||
|
||||
|
|
@ -2276,7 +2276,7 @@ inp_fix_subckt_multiplier( struct line *subckt_card,
|
|||
/* no 'm' for B line or comment line */
|
||||
if ((*(card->li_line) == '*') || (*(card->li_line) == 'b'))
|
||||
continue;
|
||||
new_str = (char*) tmalloc( strlen( card->li_line ) + 7 );
|
||||
new_str = TMALLOC(char, strlen( card->li_line ) + 7);
|
||||
sprintf( new_str, "%s m={m}", card->li_line );
|
||||
|
||||
tfree( card->li_line );
|
||||
|
|
@ -2552,20 +2552,20 @@ inp_do_macro_param_replace( int fcn_number, char *params[] )
|
|||
|
||||
if ( curr_str != NULL ) {
|
||||
if ( str_has_arith_char( params[i] ) ) {
|
||||
new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 3 );
|
||||
new_str = TMALLOC(char, strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 3);
|
||||
sprintf( new_str, "%s%s(%s)", curr_str, curr_ptr, params[i] );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 1 );
|
||||
new_str = TMALLOC(char, strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 1);
|
||||
sprintf( new_str, "%s%s%s", curr_str, curr_ptr, params[i] );
|
||||
}
|
||||
|
||||
tfree( curr_str );
|
||||
} else {
|
||||
if ( str_has_arith_char( params[i] ) ) {
|
||||
new_str = (char*) tmalloc( strlen(curr_ptr) + strlen(params[i]) + 3 );
|
||||
new_str = TMALLOC(char, strlen(curr_ptr) + strlen(params[i]) + 3);
|
||||
sprintf( new_str, "%s(%s)", curr_ptr, params[i] );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(curr_ptr) + strlen(params[i]) + 1 );
|
||||
new_str = TMALLOC(char, strlen(curr_ptr) + strlen(params[i]) + 1);
|
||||
sprintf( new_str, "%s%s", curr_ptr, params[i] );
|
||||
}
|
||||
}
|
||||
|
|
@ -2578,7 +2578,7 @@ inp_do_macro_param_replace( int fcn_number, char *params[] )
|
|||
if ( curr_str == NULL ) {
|
||||
curr_str = curr_ptr;
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + 1 );
|
||||
new_str = TMALLOC(char, strlen(curr_str) + strlen(curr_ptr) + 1);
|
||||
sprintf( new_str, "%s%s", curr_str, curr_ptr );
|
||||
tfree(curr_str);
|
||||
curr_str = new_str;
|
||||
|
|
@ -2669,11 +2669,11 @@ inp_expand_macro_in_str( char *str )
|
|||
keep = *fcn_name;
|
||||
*fcn_name = '\0';
|
||||
if ( curr_str == NULL ) {
|
||||
new_str = (char*) tmalloc( strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 );
|
||||
new_str = TMALLOC(char, strlen(str) + strlen(macro_str) + strlen(close_paren_ptr + 1) + 3);
|
||||
sprintf( new_str, "%s(%s)", str, macro_str );
|
||||
curr_str = new_str;
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(curr_str) + strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 );
|
||||
new_str = TMALLOC(char, strlen(curr_str) + strlen(str) + strlen(macro_str) + strlen(close_paren_ptr + 1) + 3);
|
||||
sprintf( new_str, "%s%s(%s)", curr_str, str, macro_str );
|
||||
tfree(curr_str);
|
||||
curr_str = new_str;
|
||||
|
|
@ -2696,7 +2696,7 @@ inp_expand_macro_in_str( char *str )
|
|||
}
|
||||
else {
|
||||
if ( str != NULL ) {
|
||||
new_str = (char*) tmalloc( strlen(curr_str) + strlen(str) + 1 );
|
||||
new_str = TMALLOC(char, strlen(curr_str) + strlen(str) + 1);
|
||||
sprintf( new_str, "%s%s", curr_str, str );
|
||||
tfree(curr_str);
|
||||
curr_str = new_str;
|
||||
|
|
@ -2831,7 +2831,7 @@ inp_fix_param_values( struct line *deck )
|
|||
end_of_str++;
|
||||
n++;
|
||||
}
|
||||
vec_str = (char*) tmalloc(n); /* string xx yyy from vector [xx yyy] */
|
||||
vec_str = TMALLOC(char, n); /* string xx yyy from vector [xx yyy] */
|
||||
*vec_str = '\0';
|
||||
strncat(vec_str, beg_of_str + 1, n - 1);
|
||||
|
||||
|
|
@ -2842,7 +2842,7 @@ inp_fix_param_values( struct line *deck )
|
|||
if (!natok) break;
|
||||
wl = alloc(struct wordlist);
|
||||
|
||||
buffer = (char*) tmalloc(strlen(natok) + 4);
|
||||
buffer = TMALLOC(char, strlen(natok) + 4);
|
||||
if ( isdigit(*natok) || *natok == '{' || *natok == '.' ||
|
||||
*natok == '"' || ( *natok == '-' && isdigit(*(natok+1)) ) ||
|
||||
ciprefix("true", natok) || ciprefix("false", natok) ||
|
||||
|
|
@ -2886,7 +2886,7 @@ inp_fix_param_values( struct line *deck )
|
|||
wl_free(nwl);
|
||||
/* insert new vector into actual line */
|
||||
*equal_ptr = '\0';
|
||||
new_str = (char*) tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 );
|
||||
new_str = TMALLOC(char, strlen(c->li_line) + strlen(newvec) + strlen(end_of_str + 1) + 5);
|
||||
sprintf( new_str, "%s=[%s] %s", c->li_line, newvec, end_of_str+1 );
|
||||
tfree(newvec);
|
||||
|
||||
|
|
@ -2903,7 +2903,7 @@ inp_fix_param_values( struct line *deck )
|
|||
end_of_str++;
|
||||
n++;
|
||||
}
|
||||
vec_str = (char*) tmalloc(n); /* string xx yyy from vector [xx yyy] */
|
||||
vec_str = TMALLOC(char, n); /* string xx yyy from vector [xx yyy] */
|
||||
*vec_str = '\0';
|
||||
strncat(vec_str, beg_of_str + 1, n - 1);
|
||||
|
||||
|
|
@ -2914,7 +2914,7 @@ inp_fix_param_values( struct line *deck )
|
|||
if (!natok) break;
|
||||
wl = alloc(struct wordlist);
|
||||
|
||||
buffer = (char*) tmalloc(strlen(natok) + 4);
|
||||
buffer = TMALLOC(char, strlen(natok) + 4);
|
||||
if ( isdigit(*natok) || *natok == '{' || *natok == '.' ||
|
||||
*natok == '"' || ( *natok == '-' && isdigit(*(natok+1)) ) ||
|
||||
ciprefix("true", natok) || ciprefix("false", natok)) {
|
||||
|
|
@ -2936,7 +2936,7 @@ inp_fix_param_values( struct line *deck )
|
|||
wl_free(nwl);
|
||||
/* insert new complex value into actual line */
|
||||
*equal_ptr = '\0';
|
||||
new_str = (char*) tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 );
|
||||
new_str = TMALLOC(char, strlen(c->li_line) + strlen(newvec) + strlen(end_of_str + 1) + 5);
|
||||
sprintf( new_str, "%s=<%s> %s", c->li_line, newvec, end_of_str+1 );
|
||||
tfree(newvec);
|
||||
|
||||
|
|
@ -2956,13 +2956,13 @@ inp_fix_param_values( struct line *deck )
|
|||
*equal_ptr = '\0';
|
||||
|
||||
if ( *end_of_str == '\0' ) {
|
||||
new_str = (char*) tmalloc( strlen(c->li_line) + strlen(beg_of_str) + 4 );
|
||||
new_str = TMALLOC(char, strlen(c->li_line) + strlen(beg_of_str) + 4);
|
||||
sprintf( new_str, "%s={%s}", c->li_line, beg_of_str );
|
||||
|
||||
} else {
|
||||
*end_of_str = '\0';
|
||||
|
||||
new_str = (char*) tmalloc( strlen(c->li_line) + strlen(beg_of_str) + strlen(end_of_str+1) + 5 );
|
||||
new_str = TMALLOC(char, strlen(c->li_line) + strlen(beg_of_str) + strlen(end_of_str + 1) + 5);
|
||||
sprintf( new_str, "%s={%s} %s", c->li_line, beg_of_str, end_of_str+1 );
|
||||
}
|
||||
old_str = c->li_line;
|
||||
|
|
@ -3168,22 +3168,22 @@ inp_sort_params( struct line *start_card, struct line *end_card, struct line *ca
|
|||
num_params = 0; /* This is just to keep the code in row 2907ff. */
|
||||
|
||||
// dynamic memory allocation
|
||||
level = (int *) tmalloc(arr_size*sizeof(int));
|
||||
param_skip = (int *) tmalloc(arr_size*sizeof(int));
|
||||
param_names = (char **) tmalloc(arr_size*sizeof(char*));
|
||||
param_strs = (char **) tmalloc(arr_size*sizeof(char*));
|
||||
level = TMALLOC(int, arr_size);
|
||||
param_skip = TMALLOC(int, arr_size);
|
||||
param_names = TMALLOC(char *, arr_size);
|
||||
param_strs = TMALLOC(char *, arr_size);
|
||||
|
||||
/* array[row][column] -> depends_on[array_size][100] */
|
||||
/* rows */
|
||||
depends_on = (char ***) tmalloc(sizeof(char **) * arr_size);
|
||||
depends_on = TMALLOC(char **, arr_size);
|
||||
/* columns */
|
||||
for (i = 0; i < arr_size; i++)
|
||||
{
|
||||
depends_on[i] = (char **) tmalloc(sizeof(char *) * 100);
|
||||
depends_on[i] = TMALLOC(char *, 100);
|
||||
}
|
||||
|
||||
ptr_array = (struct line **) tmalloc(arr_size*sizeof(struct line *));
|
||||
ptr_array_ordered = (struct line **) tmalloc(arr_size*sizeof(struct line *));
|
||||
ptr_array = TMALLOC(struct line *, arr_size);
|
||||
ptr_array_ordered = TMALLOC(struct line *, arr_size);
|
||||
|
||||
ptr = start_card;
|
||||
while ( ptr != NULL )
|
||||
|
|
@ -3298,12 +3298,12 @@ inp_sort_params( struct line *start_card, struct line *end_card, struct line *ca
|
|||
*str_ptr = '\0';
|
||||
if ( *end != '\0' )
|
||||
{
|
||||
new_str = (char*) tmalloc( strlen(curr_line) + strlen(param_names[i]) + strlen(end) + 3 );
|
||||
new_str = TMALLOC(char, strlen(curr_line) + strlen(param_names[i]) + strlen(end) + 3);
|
||||
sprintf( new_str, "%s{%s}%s", curr_line, param_names[i], end );
|
||||
}
|
||||
else
|
||||
{
|
||||
new_str = (char*) tmalloc( strlen(curr_line) + strlen(param_names[i]) + 3 );
|
||||
new_str = TMALLOC(char, strlen(curr_line) + strlen(param_names[i]) + 3);
|
||||
sprintf( new_str, "%s{%s}", curr_line, param_names[i] );
|
||||
}
|
||||
str_ptr = new_str + strlen(curr_line) + strlen(param_names[i]);
|
||||
|
|
@ -3377,7 +3377,7 @@ inp_add_params_to_subckt( struct line *subckt_card )
|
|||
while ( isspace(*param_ptr) ) param_ptr++;
|
||||
|
||||
if ( !strstr( subckt_line, "params:" ) ) {
|
||||
new_line = (char*) tmalloc( strlen(subckt_line) + strlen("params: ") + strlen(param_ptr) + 2 );
|
||||
new_line = TMALLOC(char, strlen(subckt_line) + strlen("params: ") + strlen(param_ptr) + 2);
|
||||
sprintf( new_line, "%s params: %s", subckt_line, param_ptr );
|
||||
|
||||
subckt_name = subckt_card->li_line;
|
||||
|
|
@ -3390,7 +3390,7 @@ inp_add_params_to_subckt( struct line *subckt_card )
|
|||
subckt_w_params[num_subckt_w_params++] = strdup(subckt_name);
|
||||
*end_ptr = keep;
|
||||
} else {
|
||||
new_line = (char*) tmalloc( strlen(subckt_line) + strlen(param_ptr) + 2 );
|
||||
new_line = TMALLOC(char, strlen(subckt_line) + strlen(param_ptr) + 2);
|
||||
sprintf( new_line, "%s %s", subckt_line, param_ptr );
|
||||
}
|
||||
|
||||
|
|
@ -3515,7 +3515,7 @@ inp_split_multi_param_lines( struct line *deck, int line_num )
|
|||
beg_param++;
|
||||
keep = *end_param;
|
||||
*end_param = '\0';
|
||||
new_line = (char*) tmalloc( strlen(".param ") + strlen(beg_param) + 1 );
|
||||
new_line = TMALLOC(char, strlen(".param ") + strlen(beg_param) + 1);
|
||||
sprintf( new_line, ".param %s", beg_param );
|
||||
array[counter++] = new_line;
|
||||
*end_param = keep;
|
||||
|
|
@ -3674,13 +3674,13 @@ static void inp_compat(struct line *deck)
|
|||
// Exxx n1 n2 int1 0 1
|
||||
xlen = 2*strlen(title_tok) + strlen(node1) + strlen(node2)
|
||||
+ 20 - 4*2 + 1;
|
||||
ckt_array[0] = (char*)tmalloc(xlen);
|
||||
ckt_array[0] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[0], "%s %s %s %s_int1 0 1",
|
||||
title_tok, node1, node2, title_tok);
|
||||
// BExxx int1 0 V = {equation}
|
||||
xlen = 2*strlen(title_tok) + strlen(str_ptr)
|
||||
+ 20 - 3*2 + 1;
|
||||
ckt_array[1] = (char*)tmalloc(xlen);
|
||||
ckt_array[1] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[1], "b%s %s_int1 0 v = %s",
|
||||
title_tok, title_tok, str_ptr);
|
||||
|
||||
|
|
@ -3744,13 +3744,13 @@ static void inp_compat(struct line *deck)
|
|||
// Gxxx n1 n2 int1 0 1
|
||||
xlen = 2*strlen(title_tok) + strlen(node1) + strlen(node2)
|
||||
+ 20 - 4*2 + 1;
|
||||
ckt_array[0] = (char*)tmalloc(xlen);
|
||||
ckt_array[0] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[0], "%s %s %s %s_int1 0 1",
|
||||
title_tok, node1, node2, title_tok);
|
||||
// BGxxx int1 0 V = {equation}
|
||||
xlen = 2*strlen(title_tok) + strlen(str_ptr)
|
||||
+ 20 - 3*2 + 1;
|
||||
ckt_array[1] = (char*)tmalloc(xlen);
|
||||
ckt_array[1] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[1], "b%s %s_int1 0 v = %s",
|
||||
title_tok, title_tok, str_ptr);
|
||||
|
||||
|
|
@ -3806,7 +3806,7 @@ static void inp_compat(struct line *deck)
|
|||
xlen = strlen(title_tok) + strlen(node1) + strlen(node2) +
|
||||
strlen(node1) + strlen(node2) + strlen(str_ptr) +
|
||||
28 - 6*2 + 1;
|
||||
xline = (char*)tmalloc(xlen);
|
||||
xline = TMALLOC(char, xlen);
|
||||
sprintf(xline, "b%s %s %s i = v(%s, %s)/(%s)", title_tok, node1, node2,
|
||||
node1, node2, str_ptr);
|
||||
new_line = alloc(struct line);
|
||||
|
|
@ -3847,18 +3847,18 @@ static void inp_compat(struct line *deck)
|
|||
// Exxx n-aux 0 n1 n2 1
|
||||
xlen = 2*strlen(title_tok) + strlen(node1) + strlen(node2)
|
||||
+ 21 - 4*2 + 1;
|
||||
ckt_array[0] = (char*)tmalloc(xlen);
|
||||
ckt_array[0] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[0], "e%s %s_int2 0 %s %s 1",
|
||||
title_tok, title_tok, node1, node2);
|
||||
// Cxxx n-aux 0 1
|
||||
xlen = 2*strlen(title_tok)
|
||||
+ 15 - 2*2 + 1;
|
||||
ckt_array[1] = (char*)tmalloc(xlen);
|
||||
ckt_array[1] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[1], "c%s %s_int2 0 1", title_tok, title_tok);
|
||||
// Bxxx n2 n1 I = i(Exxx) * equation
|
||||
xlen = 2*strlen(title_tok) + strlen(node2) + strlen(node1)
|
||||
+ strlen(str_ptr) + 27 - 2*5 + 1;
|
||||
ckt_array[2] = (char*)tmalloc(xlen);
|
||||
ckt_array[2] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[2], "b%s %s %s i = i(e%s) * (%s)",
|
||||
title_tok, node2, node1, title_tok, str_ptr);
|
||||
|
||||
|
|
@ -3916,18 +3916,18 @@ static void inp_compat(struct line *deck)
|
|||
// Fxxx n-aux 0 Bxxx 1
|
||||
xlen = 3*strlen(title_tok)
|
||||
+ 20 - 3*2 + 1;
|
||||
ckt_array[0] = (char*)tmalloc(xlen);
|
||||
ckt_array[0] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[0], "f%s %s_int2 0 b%s -1",
|
||||
title_tok, title_tok, title_tok);
|
||||
// Lxxx n-aux 0 1
|
||||
xlen = 2*strlen(title_tok)
|
||||
+ 15 - 2*2 + 1;
|
||||
ckt_array[1] = (char*)tmalloc(xlen);
|
||||
ckt_array[1] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[1], "l%s %s_int2 0 1", title_tok, title_tok);
|
||||
// Bxxx n1 n2 V = v(n-aux) * equation
|
||||
xlen = 2*strlen(title_tok) + strlen(node2) + strlen(node1)
|
||||
+ strlen(str_ptr) + 31 - 2*5 + 1;
|
||||
ckt_array[2] = (char*)tmalloc(xlen);
|
||||
ckt_array[2] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[2], "b%s %s %s v = v(%s_int2) * (%s)",
|
||||
title_tok, node1, node2, title_tok, str_ptr);
|
||||
|
||||
|
|
@ -4033,17 +4033,17 @@ static void inp_compat(struct line *deck)
|
|||
exp_ptr = copy_substring(beg_ptr, end_ptr-2);
|
||||
cut_line = str_ptr;
|
||||
// generate node
|
||||
out_ptr = (char*)tmalloc(6);
|
||||
out_ptr = TMALLOC(char, 6);
|
||||
sprintf(out_ptr, "pa_%02d", pai);
|
||||
// Bout_ptr out_ptr 0 V = v(expr_ptr)
|
||||
xlen = 2*strlen(out_ptr) + strlen(exp_ptr )+ 15 - 2*3 + 1;
|
||||
ckt_array[pai] = (char*)tmalloc(xlen);
|
||||
ckt_array[pai] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[pai], "b%s %s 0 v = %s",
|
||||
out_ptr, out_ptr, exp_ptr);
|
||||
ckt_array[++pai] = NULL;
|
||||
// length of the replacement V(out_ptr)
|
||||
xlen = strlen(out_ptr) + 4;
|
||||
del_ptr = copy_ptr = (char*)tmalloc(xlen);
|
||||
del_ptr = copy_ptr = TMALLOC(char, xlen);
|
||||
sprintf(copy_ptr, "v(%s)", out_ptr);
|
||||
// length of the replacement part in original line
|
||||
xlen = strlen(exp_ptr) + 7;
|
||||
|
|
@ -4064,17 +4064,17 @@ static void inp_compat(struct line *deck)
|
|||
end_ptr++;
|
||||
exp_ptr = copy_substring(beg_ptr, end_ptr-3);
|
||||
// generate node
|
||||
out_ptr = (char*)tmalloc(6);
|
||||
out_ptr = TMALLOC(char, 6);
|
||||
sprintf(out_ptr, "pa_%02d", pai);
|
||||
// Bout_ptr out_ptr 0 V = v(expr_ptr)
|
||||
xlen = 2*strlen(out_ptr) + strlen(exp_ptr )+ 15 - 2*3 + 1;
|
||||
ckt_array[pai] = (char*)tmalloc(xlen);
|
||||
ckt_array[pai] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[pai], "b%s %s 0 v = %s",
|
||||
out_ptr, out_ptr, exp_ptr);
|
||||
ckt_array[++pai] = NULL;
|
||||
// length of the replacement V(out_ptr)
|
||||
xlen = strlen(out_ptr) + 4;
|
||||
del_ptr = copy_ptr = (char*)tmalloc(xlen);
|
||||
del_ptr = copy_ptr = TMALLOC(char, xlen);
|
||||
sprintf(copy_ptr, "v(%s)", out_ptr);
|
||||
// length of the replacement part in original line
|
||||
xlen = strlen(exp_ptr) + 9;
|
||||
|
|
@ -4150,17 +4150,17 @@ static void inp_compat(struct line *deck)
|
|||
exp_ptr = copy_substring(beg_ptr, end_ptr-2);
|
||||
cut_line = str_ptr;
|
||||
// generate node
|
||||
out_ptr = (char*)tmalloc(6);
|
||||
out_ptr = TMALLOC(char, 6);
|
||||
sprintf(out_ptr, "pa_%02d", pai);
|
||||
// Bout_ptr out_ptr 0 V = v(expr_ptr)
|
||||
xlen = 2*strlen(out_ptr) + strlen(exp_ptr )+ 15 - 2*3 + 1;
|
||||
ckt_array[pai] = (char*)tmalloc(xlen);
|
||||
ckt_array[pai] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[pai], "b%s %s 0 v = %s",
|
||||
out_ptr, out_ptr, exp_ptr);
|
||||
ckt_array[++pai] = NULL;
|
||||
// length of the replacement V(out_ptr)
|
||||
xlen = strlen(out_ptr) + 1;
|
||||
del_ptr = copy_ptr = (char*)tmalloc(xlen);
|
||||
del_ptr = copy_ptr = TMALLOC(char, xlen);
|
||||
sprintf(copy_ptr, "%s", out_ptr);
|
||||
// length of the replacement part in original line
|
||||
xlen = strlen(exp_ptr) + 7;
|
||||
|
|
@ -4189,13 +4189,13 @@ static void inp_compat(struct line *deck)
|
|||
exp_ptr = copy_substring(beg_ptr, end_ptr-3);
|
||||
// Bout_ptr out_ptr 0 V = v(expr_ptr)
|
||||
xlen = 2*strlen(out_ptr) + strlen(exp_ptr )+ 15 - 2*3 + 1;
|
||||
ckt_array[pai] = (char*)tmalloc(xlen);
|
||||
ckt_array[pai] = TMALLOC(char, xlen);
|
||||
sprintf(ckt_array[pai], "b%s %s 0 v = %s",
|
||||
out_ptr, out_ptr, exp_ptr);
|
||||
ckt_array[++pai] = NULL;
|
||||
// length of the replacement V(out_ptr)
|
||||
xlen = strlen(out_ptr) + 1;
|
||||
del_ptr = copy_ptr = (char*)tmalloc(xlen);
|
||||
del_ptr = copy_ptr = TMALLOC(char, xlen);
|
||||
sprintf(copy_ptr, "%s", out_ptr);
|
||||
// length of the replacement part in original line
|
||||
xlen = strlen(out_ptr) + strlen(exp_ptr) + 10;
|
||||
|
|
@ -4464,7 +4464,7 @@ static void inp_bsource_compat(struct line *deck)
|
|||
/* {} around all other tokens */
|
||||
else {
|
||||
xlen = strlen(buf);
|
||||
tmp_char = (char*) tmalloc(xlen + 3);
|
||||
tmp_char = TMALLOC(char, xlen + 3);
|
||||
sprintf(tmp_char, "{%s}", buf);
|
||||
cwl->wl_word = tmp_char;
|
||||
}
|
||||
|
|
@ -4475,7 +4475,7 @@ static void inp_bsource_compat(struct line *deck)
|
|||
{
|
||||
/* allow 100p, 5MEG etc. */
|
||||
dvalue = INPevaluate(&str_ptr, &error1, 2);
|
||||
cvalue = (char*) tmalloc(19);
|
||||
cvalue = TMALLOC(char, 19);
|
||||
sprintf(cvalue,"%18.10e", dvalue);
|
||||
/* unary -, change sign */
|
||||
if (ustate == 2) {
|
||||
|
|
@ -4510,7 +4510,7 @@ static void inp_bsource_compat(struct line *deck)
|
|||
/* cut the tmp_char after the equal sign */
|
||||
*(equal_ptr + 1) = '\0';
|
||||
xlen = strlen(tmp_char) + strlen(new_str) + 2;
|
||||
final_str = (char*) tmalloc(xlen);
|
||||
final_str = TMALLOC(char, xlen);
|
||||
sprintf(final_str, "%s %s", tmp_char, new_str);
|
||||
|
||||
new_line = alloc(struct line);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ lincopy(struct dvec *ov, double *newscale, int newlen, struct dvec *oldscale)
|
|||
v->v_flags |= VF_PERMANENT;
|
||||
v->v_length = newlen;
|
||||
|
||||
nd = (double *) tmalloc(newlen * sizeof (double));
|
||||
nd = TMALLOC(double, newlen);
|
||||
if (!ft_interpolate(ov->v_realdata, nd, oldscale->v_realdata,
|
||||
oldscale->v_length, newscale, newlen, 1)) {
|
||||
fprintf(cp_err, "Error: can't interpolate %s\n", ov->v_name);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ com_linearize(wordlist *wl)
|
|||
newtime->v_flags |= VF_PERMANENT;
|
||||
newtime->v_length = len;
|
||||
newtime->v_plot = new;
|
||||
newtime->v_realdata = (double *) tmalloc(len * sizeof (double));
|
||||
newtime->v_realdata = TMALLOC(double, len);
|
||||
for (i = 0, d = tstart; i < len; i++, d += tstep)
|
||||
newtime->v_realdata[i] = d;
|
||||
new->pl_scale = new->pl_dvecs = newtime;
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ static wordlist *measure_parse_line( char *line )
|
|||
break ;
|
||||
}
|
||||
len += strlen( extra_item ) + 2 ;
|
||||
long_str = (char*) MALLOC(len) ;
|
||||
long_str = TMALLOC(char, len) ;
|
||||
sprintf( long_str, "%s%s", item, extra_item ) ;
|
||||
txfree( item ) ;
|
||||
txfree( extra_item ) ;
|
||||
|
|
|
|||
|
|
@ -455,8 +455,8 @@ nupa_init (char *srcfile)
|
|||
dicoS = (tdico *)new(sizeof(tdico));
|
||||
initdico (dicoS);
|
||||
|
||||
dicoS->dynrefptr = (char**)tmalloc((dynmaxline + 1)*sizeof(char*));
|
||||
dicoS->dyncategory = (char*)tmalloc((dynmaxline + 1)*sizeof(char));
|
||||
dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1);
|
||||
dicoS->dyncategory = TMALLOC(char, dynmaxline + 1);
|
||||
|
||||
for (i = 0; i <= dynmaxline; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,8 +194,8 @@ initdico (tdico * dico)
|
|||
dico->stack_depth = 0 ; /* top of the stack */
|
||||
asize = dico->symbol_stack_alloc = 10 ;/* expected stack depth - no longer limited */
|
||||
asize++ ; /* account for zero */
|
||||
dico->local_symbols = (NGHASHPTR*) tmalloc( asize * sizeof(NGHASHPTR) ) ;
|
||||
dico->inst_name = (char**) tmalloc( asize * sizeof(char *) ) ;
|
||||
dico->local_symbols = TMALLOC(NGHASHPTR, asize) ;
|
||||
dico->inst_name = TMALLOC(char*, asize) ;
|
||||
dico->inst_symbols = NULL ; /* instance qualified are lazily allocated */
|
||||
|
||||
initkeys ();
|
||||
|
|
@ -245,8 +245,8 @@ dicostack (tdico * dico, char op)
|
|||
/* Just double the stack alloc */
|
||||
dico->symbol_stack_alloc *= 2 ;
|
||||
asize = dico->symbol_stack_alloc + 1 ; /* account for zero */
|
||||
dico->local_symbols = (NGHASHPTR*) trealloc( dico->local_symbols, asize * sizeof(NGHASHPTR) ) ;
|
||||
dico->inst_name = (char**) trealloc( dico->inst_name, asize * sizeof(char *) ) ;
|
||||
dico->local_symbols = TREALLOC(NGHASHPTR, dico->local_symbols, asize) ;
|
||||
dico->inst_name = TREALLOC(char*, dico->inst_name, asize) ;
|
||||
}
|
||||
/* lazy allocation - don't allocate space if we can help it */
|
||||
dico->local_symbols[dico->stack_depth] = NULL ;
|
||||
|
|
@ -400,7 +400,7 @@ attrib (tdico *dico_p, NGHASHPTR htable_p, char *t, char op)
|
|||
|
||||
if (!(entry_p))
|
||||
{
|
||||
entry_p = (entry*) tmalloc( sizeof(entry) ) ;
|
||||
entry_p = TMALLOC(entry, 1) ;
|
||||
entry_p->symbol = strdup( t ) ;
|
||||
entry_p->tp = '?'; /* signal Unknown */
|
||||
entry_p->level = dico_p->stack_depth ;
|
||||
|
|
|
|||
|
|
@ -214,13 +214,13 @@ inp_getoptsc(char *in_line, struct line *com_options)
|
|||
struct line *next = NULL;
|
||||
char* line;
|
||||
|
||||
line = (char*)tmalloc(strlen(in_line) + 3);
|
||||
line = TMALLOC(char, strlen(in_line) + 3);
|
||||
/* option -> .options */
|
||||
/* skip option */
|
||||
gettok(&in_line);
|
||||
sprintf(line, ".options %s", in_line);
|
||||
|
||||
next = (struct line*)tmalloc(sizeof(struct line));
|
||||
next = TMALLOC(struct line, 1);
|
||||
next->li_line = line;
|
||||
next->li_linenum = 0;
|
||||
next->li_error = NULL;
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
|
|||
*/
|
||||
numsaves = ft_getSaves(&saves);
|
||||
if (numsaves) {
|
||||
savesused = (bool *) tmalloc(sizeof (bool) * numsaves);
|
||||
savesused = TMALLOC(bool, numsaves);
|
||||
saveall = FALSE;
|
||||
for (i = 0; i < numsaves; i++) {
|
||||
if (saves[i].analysis && !cieq((char *)saves[i].analysis, an_name)) {
|
||||
|
|
@ -382,10 +382,9 @@ addDataDesc(runDesc *run, char *name, int type, int ind)
|
|||
dataDesc *data;
|
||||
|
||||
if (!run->numData)
|
||||
run->data = (dataDesc *) tmalloc(sizeof (dataDesc));
|
||||
run->data = TMALLOC(dataDesc, 1);
|
||||
else
|
||||
run->data = (dataDesc *) trealloc((char *) run->data,
|
||||
sizeof (dataDesc) * (run->numData + 1));
|
||||
run->data = TREALLOC(dataDesc, run->data, run->numData + 1);
|
||||
data = &run->data[run->numData];
|
||||
/* so freeRun will get nice NULL pointers for the fields we don't set */
|
||||
bzero(data, sizeof(dataDesc));
|
||||
|
|
@ -413,10 +412,9 @@ addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind)
|
|||
char *unique; /* unique char * from back-end */
|
||||
|
||||
if (!run->numData)
|
||||
run->data = (dataDesc *) tmalloc(sizeof (dataDesc));
|
||||
run->data = TMALLOC(dataDesc, 1);
|
||||
else
|
||||
run->data = (dataDesc *) trealloc((char *) run->data,
|
||||
sizeof (dataDesc) * (run->numData + 1));
|
||||
run->data = TREALLOC(dataDesc, run->data, run->numData + 1);
|
||||
data = &run->data[run->numData];
|
||||
/* so freeRun will get nice NULL pointers for the fields we don't set */
|
||||
bzero(data, sizeof(dataDesc));
|
||||
|
|
@ -979,12 +977,12 @@ plotAddRealValue(dataDesc *desc, double value)
|
|||
struct dvec *v = desc->vec;
|
||||
|
||||
if (isreal(v)) {
|
||||
v->v_realdata = (double *) newrealloc((char *) v->v_realdata,
|
||||
v->v_realdata = (double *) newrealloc(v->v_realdata,
|
||||
sizeof (double) * (v->v_length + 1));
|
||||
v->v_realdata[v->v_length] = value;
|
||||
} else {
|
||||
/* a real parading as a VF_COMPLEX */
|
||||
v->v_compdata = (ngcomplex_t *) newrealloc((char *) v->v_compdata,
|
||||
v->v_compdata = (ngcomplex_t *) newrealloc(v->v_compdata,
|
||||
sizeof(ngcomplex_t) * (v->v_length + 1));
|
||||
v->v_compdata[v->v_length].cx_real = value;
|
||||
v->v_compdata[v->v_length].cx_imag = (double) 0;
|
||||
|
|
@ -1000,7 +998,7 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
|
|||
{
|
||||
struct dvec *v = desc->vec;
|
||||
|
||||
v->v_compdata = (ngcomplex_t *) newrealloc((char *) v->v_compdata,
|
||||
v->v_compdata = (ngcomplex_t *) newrealloc(v->v_compdata,
|
||||
sizeof(ngcomplex_t) * (v->v_length + 1));
|
||||
v->v_compdata[v->v_length].cx_real = value.real;
|
||||
v->v_compdata[v->v_length].cx_imag = value.imag;
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ mknnode(double number)
|
|||
v->v_name = copy(buf);
|
||||
v->v_type = SV_NOTYPE;
|
||||
v->v_flags = VF_REAL;
|
||||
v->v_realdata = (double *) tmalloc(sizeof (double));
|
||||
v->v_realdata = TMALLOC(double, 1);
|
||||
*v->v_realdata = number;
|
||||
v->v_length = 1;
|
||||
v->v_plot = NULL;
|
||||
|
|
|
|||
|
|
@ -627,7 +627,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create)
|
|||
place->cc_sibling->cc_ysibling = place;
|
||||
place->cc_sibling->cc_parent = place->cc_parent;
|
||||
place = place->cc_sibling;
|
||||
place->cc_name = (char*) tmalloc(ind + 2);
|
||||
place->cc_name = TMALLOC(char, ind + 2);
|
||||
for (i = 0; i < ind + 1; i++)
|
||||
place->cc_name[i] = word[i];
|
||||
place->cc_name[ind + 1] = '\0';
|
||||
|
|
@ -651,7 +651,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create)
|
|||
tmpc->cc_parent->cc_child = tmpc;
|
||||
else
|
||||
*dd = place;
|
||||
place->cc_name = (char*) tmalloc(ind + 2);
|
||||
place->cc_name = TMALLOC(char, ind + 2);
|
||||
for (i = 0; i < ind + 1; i++)
|
||||
place->cc_name[i] = word[i];
|
||||
place->cc_name[ind + 1] = '\0';
|
||||
|
|
@ -673,7 +673,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create)
|
|||
tmpc->cc_parent = place;
|
||||
place->cc_child = tmpc;
|
||||
place = tmpc;
|
||||
place->cc_name = (char*) tmalloc(ind + 3);
|
||||
place->cc_name = TMALLOC(char, ind + 3);
|
||||
for (i = 0; i < ind + 2; i++)
|
||||
place->cc_name[i] = word[i];
|
||||
place->cc_name[ind + 2] = '\0';
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ brac1(char *string)
|
|||
int nb;
|
||||
|
||||
words = alloc(struct wordlist);
|
||||
words->wl_word = (char*) tmalloc(BSIZE_SP);
|
||||
words->wl_word = TMALLOC(char, BSIZE_SP);
|
||||
words->wl_word[0] = 0;
|
||||
words->wl_next = NULL;
|
||||
words->wl_prev = NULL;
|
||||
|
|
@ -144,7 +144,7 @@ brac1(char *string)
|
|||
nw = alloc(struct wordlist);
|
||||
nw->wl_next = NULL;
|
||||
nw->wl_prev = NULL;
|
||||
nw->wl_word = (char*) tmalloc(BSIZE_SP);
|
||||
nw->wl_word = TMALLOC(char, BSIZE_SP);
|
||||
(void) strcpy(nw->wl_word, wl->wl_word);
|
||||
(void) strcat(nw->wl_word, w->wl_word);
|
||||
newwl = wl_append(newwl, nw);
|
||||
|
|
|
|||
|
|
@ -95,11 +95,11 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
|||
v->v_linestyle = (PCHARS[i] ? PCHARS[i++] : '#');
|
||||
}
|
||||
/* Now allocate the field and stuff. */
|
||||
field = (char*) tmalloc((maxy + 1) * (maxx + 1));
|
||||
line1 = (char*) tmalloc(maxy + margin + FUDGE + 1);
|
||||
line2 = (char*) tmalloc(maxy + margin + FUDGE + 1);
|
||||
field = TMALLOC(char, (maxy + 1) * (maxx + 1));
|
||||
line1 = TMALLOC(char, maxy + margin + FUDGE + 1);
|
||||
line2 = TMALLOC(char, maxy + margin + FUDGE + 1);
|
||||
if (!novalue)
|
||||
values = (double *) tmalloc(maxx * sizeof (double));
|
||||
values = TMALLOC(double, maxx);
|
||||
|
||||
/* Clear the field, put the lines in the right places, and create
|
||||
* the headers.
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
|
|||
pname = "(unknown)";
|
||||
if (!plotname)
|
||||
plotname = "(unknown)";
|
||||
comb_title = (char*) tmalloc(strlen(plotname) + strlen(pname) + 3);
|
||||
comb_title = TMALLOC(char, strlen(plotname) + strlen(pname) + 3);
|
||||
sprintf(comb_title, "%s: %s", pname, plotname);
|
||||
graph->plotname = comb_title;
|
||||
#endif
|
||||
|
|
@ -191,7 +191,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
|
|||
pname = "(unknown)";
|
||||
if (!plotname)
|
||||
plotname = "(unknown)";
|
||||
comb_title = (char*) tmalloc(strlen(plotname) + strlen(pname) + 3);
|
||||
comb_title = TMALLOC(char, strlen(plotname) + strlen(pname) + 3);
|
||||
sprintf(comb_title, "%s: %s", pname, plotname);
|
||||
graph->plotname = comb_title;
|
||||
#endif
|
||||
|
|
@ -359,7 +359,7 @@ gr_start_internal(struct dvec *dv, bool copyvec)
|
|||
dv->v_color = curcolor;
|
||||
|
||||
/* save the data so we can refresh */
|
||||
link = (struct dveclist *) tmalloc(sizeof(struct dveclist));
|
||||
link = TMALLOC(struct dveclist, 1);
|
||||
link->next = currentgraph->plotdata;
|
||||
|
||||
if (copyvec) {
|
||||
|
|
@ -1043,7 +1043,7 @@ readtics(char *string)
|
|||
char *words, *worde;
|
||||
double *tics, *ticsk;
|
||||
|
||||
tics = (double *) tmalloc(MAXTICS * sizeof(double));
|
||||
tics = TMALLOC(double, MAXTICS);
|
||||
ticsk = tics;
|
||||
words = string;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ typedef struct listgraph {
|
|||
GRAPH graph;
|
||||
struct listgraph *next;
|
||||
} LISTGRAPH;
|
||||
#define NEWLISTGRAPH (LISTGRAPH *) tmalloc(sizeof(LISTGRAPH))
|
||||
#define NEWLISTGRAPH TMALLOC(LISTGRAPH, 1)
|
||||
|
||||
#define NUMGBUCKETS 16
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ GRAPH *CopyGraph(GRAPH *graph)
|
|||
/* copy dvecs */
|
||||
ret->plotdata = NULL;
|
||||
for (link = graph->plotdata; link; link = link->next) {
|
||||
newlink = (struct dveclist *) tmalloc(sizeof(struct dveclist));
|
||||
newlink = TMALLOC(struct dveclist, 1);
|
||||
newlink->next = ret->plotdata;
|
||||
newlink->vector = vec_copy(link->vector);
|
||||
/* vec_copy doesn't set v_color or v_linestyle */
|
||||
|
|
@ -246,7 +246,7 @@ typedef struct gcstack {
|
|||
struct gcstack *next;
|
||||
} GCSTACK;
|
||||
GCSTACK *gcstacktop;
|
||||
#define NEWGCSTACK (GCSTACK *) tmalloc(sizeof(GCSTACK))
|
||||
#define NEWGCSTACK TMALLOC(GCSTACK, 1)
|
||||
|
||||
/* note: This Push and Pop has tricky semantics.
|
||||
Push(graph) will push the currentgraph onto the stack
|
||||
|
|
|
|||
|
|
@ -158,21 +158,19 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
|
|||
|
||||
if (gridsize) {
|
||||
/* This is done quite differently from what we do below... */
|
||||
gridbuf = (double *) tmalloc(gridsize * sizeof (double));
|
||||
result = (double *) tmalloc(gridsize * sizeof (double));
|
||||
gridbuf = TMALLOC(double, gridsize);
|
||||
result = TMALLOC(double, gridsize);
|
||||
if (isreal(v))
|
||||
ydata = v->v_realdata;
|
||||
else {
|
||||
ydata = (double *) tmalloc(v->v_length *
|
||||
sizeof (double));
|
||||
ydata = TMALLOC(double, v->v_length);
|
||||
for (i = 0; i < v->v_length; i++)
|
||||
ydata[i] = realpart(&v->v_compdata[i]);
|
||||
}
|
||||
if (isreal(xs))
|
||||
xdata = xs->v_realdata;
|
||||
else {
|
||||
xdata = (double *) tmalloc(xs->v_length *
|
||||
sizeof (double));
|
||||
xdata = TMALLOC(double, xs->v_length);
|
||||
for (i = 0; i < xs->v_length; i++)
|
||||
xdata[i] = realpart(&xs->v_compdata[i]);
|
||||
}
|
||||
|
|
@ -211,11 +209,10 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
|
|||
/* We need to do curve fitting now. First get some scratch
|
||||
* space
|
||||
*/
|
||||
scratch = (double *) tmalloc(((degree + 1) * (degree + 2)) *
|
||||
sizeof (double));
|
||||
result = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
xdata = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
ydata = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
scratch = TMALLOC(double, (degree + 1) * (degree + 2));
|
||||
result = TMALLOC(double, degree + 1);
|
||||
xdata = TMALLOC(double, degree + 1);
|
||||
ydata = TMALLOC(double, degree + 1);
|
||||
|
||||
|
||||
/* Plot the first degree segments... */
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ getlims(wordlist *wl, char *name, int number)
|
|||
}
|
||||
wk = beg;
|
||||
if (number) {
|
||||
d = (double *) tmalloc(sizeof (double) *
|
||||
number);
|
||||
d = TMALLOC(double, number);
|
||||
for (n = 0; n < number; n++) {
|
||||
wk = wk->wl_next;
|
||||
if (!wk) {
|
||||
|
|
@ -101,7 +100,7 @@ xtend(struct dvec *v, int length)
|
|||
}
|
||||
if (isreal(v)) {
|
||||
od = v->v_realdata;
|
||||
v->v_realdata = (double *) tmalloc(length * sizeof (double));
|
||||
v->v_realdata = TMALLOC(double, length);
|
||||
for (i = 0; i < v->v_length; i++)
|
||||
v->v_realdata[i] = od[i];
|
||||
d = od[--i];
|
||||
|
|
@ -110,7 +109,7 @@ xtend(struct dvec *v, int length)
|
|||
tfree(od);
|
||||
} else {
|
||||
oc = v->v_compdata;
|
||||
v->v_compdata = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
|
||||
v->v_compdata = TMALLOC(ngcomplex_t, length);
|
||||
for (i = 0; i < v->v_length; i++) {
|
||||
realpart(&v->v_compdata[i]) = realpart(&oc[i]);
|
||||
imagpart(&v->v_compdata[i]) = imagpart(&oc[i]);
|
||||
|
|
@ -940,7 +939,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
|
|||
|
||||
newlen = (tstop - tstart) / tstep + 1.5;
|
||||
|
||||
newscale = (double *) tmalloc(newlen * sizeof(double));
|
||||
newscale = TMALLOC(double, newlen);
|
||||
|
||||
newv_scale = alloc(struct dvec);
|
||||
newv_scale->v_flags = vecs->v_scale->v_flags;
|
||||
|
|
@ -954,7 +953,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
|
|||
newscale[i] = ttime;
|
||||
|
||||
for (v = vecs; v; v= v->v_link2) {
|
||||
newdata = (double *) tmalloc(newlen * sizeof (double));
|
||||
newdata = TMALLOC(double, newlen);
|
||||
|
||||
if (!ft_interpolate(v->v_realdata, newdata,
|
||||
v->v_scale->v_realdata, v->v_scale->v_length,
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ X11_NewViewport(GRAPH *graph)
|
|||
};
|
||||
int trys;
|
||||
|
||||
graph->devdep = (X11devdep*) tmalloc(sizeof(X11devdep));
|
||||
graph->devdep = TMALLOC(X11devdep, 1);
|
||||
|
||||
/* set up new shell */
|
||||
DEVDEP(graph).shell = XtCreateApplicationShell("shell",
|
||||
|
|
|
|||
|
|
@ -745,9 +745,9 @@ com_cross(wordlist *wl)
|
|||
v->v_flags |= VF_PERMANENT;
|
||||
v->v_flags = comp ? VF_COMPLEX : VF_REAL;
|
||||
if (comp)
|
||||
v->v_compdata = (ngcomplex_t *) tmalloc(i * sizeof(ngcomplex_t));
|
||||
v->v_compdata = TMALLOC(ngcomplex_t, i);
|
||||
else
|
||||
v->v_realdata = (double *) tmalloc(i * sizeof (double));
|
||||
v->v_realdata = TMALLOC(double, i);
|
||||
|
||||
/* Now copy the ind'ths elements into this one. */
|
||||
for (n = vecs, i = 0; n; n = n->v_link2, i++)
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ PS_NewViewport(GRAPH *graph)
|
|||
fprintf(plotfile, "/%s findfont %d scalefont setfont\n\n",
|
||||
psfont, (int) (fontsize * scale));
|
||||
|
||||
graph->devdep = (PSdevdep*) tmalloc(sizeof(PSdevdep));
|
||||
graph->devdep = TMALLOC(PSdevdep, 1);
|
||||
DEVDEP(graph).lastlinestyle = -1;
|
||||
DEVDEP(graph).lastcolor = -1;
|
||||
DEVDEP(graph).lastx = -1;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ cp_unquote(char *string)
|
|||
int l;
|
||||
if (string) {
|
||||
l = strlen(string);
|
||||
s = (char*) MALLOC(l+1);
|
||||
s = TMALLOC(char, l + 1);
|
||||
|
||||
if (l>=2 && *string == '"' && string[l-1] == '"') {
|
||||
strncpy(s,string+1,l-2);
|
||||
|
|
|
|||
|
|
@ -568,11 +568,9 @@ raw_read(char *name)
|
|||
* be dangerous if the file is invalid.
|
||||
*/
|
||||
if (isreal(v))
|
||||
v->v_realdata = (double *) tmalloc(
|
||||
npoints * sizeof (double));
|
||||
v->v_realdata = TMALLOC(double, npoints);
|
||||
else
|
||||
v->v_compdata = (ngcomplex_t *) tmalloc(
|
||||
npoints * sizeof(ngcomplex_t));
|
||||
v->v_compdata = TMALLOC(ngcomplex_t, npoints);
|
||||
}
|
||||
} else if (ciprefix("values:", buf) ||
|
||||
ciprefix("binary:", buf)) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ com_spec(wordlist *wl)
|
|||
1/(time[tlen-1] - time[0]));
|
||||
return;
|
||||
}
|
||||
win = (double *) tmalloc(tlen * sizeof (double));
|
||||
win = TMALLOC(double, tlen);
|
||||
{
|
||||
char window[BSIZE_SP];
|
||||
double maxt = time[tlen-1];
|
||||
|
|
@ -203,7 +203,7 @@ com_spec(wordlist *wl)
|
|||
plot_cur->pl_name = copy("Spectrum");
|
||||
plot_cur->pl_date = copy(datestring( ));
|
||||
|
||||
freq = (double *) tmalloc(fpts * sizeof(double));
|
||||
freq = TMALLOC(double, fpts);
|
||||
f = alloc(struct dvec);
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
|
|
@ -213,11 +213,11 @@ com_spec(wordlist *wl)
|
|||
f->v_realdata = freq;
|
||||
vec_new(f);
|
||||
|
||||
tdvec = (double **) tmalloc(ngood * sizeof(double *));
|
||||
fdvec = (ngcomplex_t **) tmalloc(ngood * sizeof(ngcomplex_t *));
|
||||
tdvec = TMALLOC(double *, ngood);
|
||||
fdvec = TMALLOC(ngcomplex_t *, ngood);
|
||||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata;
|
||||
fdvec[i] = (ngcomplex_t *) tmalloc(fpts * sizeof(ngcomplex_t));
|
||||
fdvec[i] = TMALLOC(ngcomplex_t, fpts);
|
||||
f = alloc(struct dvec);
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
|
|
@ -229,7 +229,7 @@ com_spec(wordlist *wl)
|
|||
vec = vec->v_link2;
|
||||
}
|
||||
|
||||
dc = (double *) tmalloc(ngood * sizeof(double));
|
||||
dc = TMALLOC(double, ngood);
|
||||
for (i = 0; i<ngood; i++) {
|
||||
dc[i] = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1367,7 +1367,7 @@ void com_loadsnap(wordlist *wl) {
|
|||
return;
|
||||
}
|
||||
|
||||
my_ckt = (CKTcircuit *)tmalloc(sizeof(CKTcircuit));
|
||||
my_ckt = TMALLOC(CKTcircuit, 1);
|
||||
|
||||
fread(my_ckt,sizeof(CKTcircuit),1,file);
|
||||
|
||||
|
|
|
|||
|
|
@ -758,7 +758,7 @@ bxx_init(struct bxx_buffer *t)
|
|||
{
|
||||
/* assert(0 == (bxx_chunksize & (bxx_chunksize - 1))); */
|
||||
|
||||
t->buffer = (char*) tmalloc(bxx_chunksize);
|
||||
t->buffer = TMALLOC(char, bxx_chunksize);
|
||||
|
||||
t->dst = t->buffer;
|
||||
t->limit = t->buffer + bxx_chunksize;
|
||||
|
|
@ -788,7 +788,7 @@ bxx_extend(struct bxx_buffer *t, int howmuch)
|
|||
|
||||
len += howmuch;
|
||||
|
||||
t->buffer = (char*) trealloc(t->buffer, len*sizeof(char));
|
||||
t->buffer = TREALLOC(char, t->buffer, len);
|
||||
|
||||
t->dst = t->buffer + pos;
|
||||
t->limit = t->buffer + len;
|
||||
|
|
@ -913,10 +913,10 @@ translate(struct line *deck, char *formal, char *actual, char *scname, char *sub
|
|||
t = gettrans(name, NULL);
|
||||
|
||||
if (t) {
|
||||
new_str = (char*) tmalloc( strlen(s) + strlen(t) + strlen(paren_ptr+1) + 3 );
|
||||
new_str = TMALLOC(char, strlen(s) + strlen(t) + strlen(paren_ptr + 1) + 3);
|
||||
sprintf( new_str, "%s(%s)%s", s, t, paren_ptr+1 );
|
||||
} else {
|
||||
new_str = (char*) tmalloc( strlen(s) + strlen(scname) + strlen(name) + strlen(paren_ptr+1) + 4 );
|
||||
new_str = TMALLOC(char, strlen(s) + strlen(scname) + strlen(name) + strlen(paren_ptr + 1) + 4);
|
||||
sprintf( new_str, "%s(%s.%s)%s", s, scname, name, paren_ptr+1 );
|
||||
}
|
||||
|
||||
|
|
@ -1644,8 +1644,7 @@ modtranslate(struct line *deck, char *subname)
|
|||
#endif
|
||||
|
||||
name = gettok(&t); /* at this point, name = .model */
|
||||
buffer = (char*) tmalloc(strlen(name) + strlen(t) +
|
||||
strlen(subname) + 4);
|
||||
buffer = TMALLOC(char, strlen(name) + strlen(t) + strlen(subname) + 4);
|
||||
(void) sprintf(buffer, "%s ",name); /* at this point, buffer = ".model " */
|
||||
tfree(name);
|
||||
name = gettok(&t); /* name now holds model name */
|
||||
|
|
@ -1724,7 +1723,7 @@ devmodtranslate(struct line *deck, char *subname)
|
|||
t++;
|
||||
c = isupper(*t) ? tolower(*t) : *t; /* set c to first char in line. . . . */
|
||||
found = FALSE;
|
||||
buffer = (char*) tmalloc(strlen(t) + strlen(subname) + 4);
|
||||
buffer = TMALLOC(char, strlen(t) + strlen(subname) + 4);
|
||||
|
||||
switch (c) {
|
||||
|
||||
|
|
|
|||
|
|
@ -897,7 +897,7 @@ cp_vprint(void)
|
|||
for (v = variables; v; v = v->va_next)
|
||||
i++;
|
||||
|
||||
vars = (struct xxx *) tmalloc(sizeof (struct xxx) * i);
|
||||
vars = TMALLOC(struct xxx, i);
|
||||
|
||||
out_init();
|
||||
for (v = variables, i = 0; v; v = v->va_next, i++) {
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ sortvecs(struct dvec *d)
|
|||
i++;
|
||||
if (i < 2)
|
||||
return (d);
|
||||
array = (struct dvec **) tmalloc(i * sizeof (struct dvec *));
|
||||
array = TMALLOC(struct dvec *, i);
|
||||
for (t = d, i = 0; t; t = t->v_link2)
|
||||
array[i++] = t;
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ vec_get(const char *vec_name)
|
|||
d->v_name = copy(whole); /* MW. The same as word before */
|
||||
d->v_type = SV_NOTYPE;
|
||||
d->v_flags |= VF_REAL; /* No complex values yet... */
|
||||
d->v_realdata = (double *) tmalloc(sizeof (double));
|
||||
d->v_realdata = TMALLOC(double, 1);
|
||||
d->v_length = 1;
|
||||
|
||||
/* In case the represented variable is a REAL vector this takes
|
||||
|
|
@ -517,13 +517,13 @@ vec_get(const char *vec_name)
|
|||
*/
|
||||
struct variable *nv;
|
||||
double *list;
|
||||
list = (double *)MALLOC(sizeof(double));
|
||||
list = TMALLOC(double, 1);
|
||||
nv = alloc(struct variable);
|
||||
|
||||
nv = vv->va_vlist;
|
||||
for(i=1; ;i++)
|
||||
{
|
||||
list=(double *)REALLOC((char *)list,i*sizeof(double));
|
||||
list=TREALLOC(double, list, i);
|
||||
*(list+i-1) = nv->va_real;
|
||||
nv = nv->va_next;
|
||||
if (nv==NULL) break;
|
||||
|
|
@ -643,15 +643,13 @@ vec_copy(struct dvec *v)
|
|||
nv->v_flags = v->v_flags & ~VF_PERMANENT;
|
||||
|
||||
if (isreal(v)) {
|
||||
nv->v_realdata = (double *) tmalloc(sizeof (double) *
|
||||
v->v_length);
|
||||
nv->v_realdata = TMALLOC(double, v->v_length);
|
||||
bcopy(v->v_realdata, nv->v_realdata,
|
||||
sizeof (double) * v->v_length);
|
||||
nv->v_compdata = NULL;
|
||||
} else {
|
||||
nv->v_realdata = NULL;
|
||||
nv->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) *
|
||||
v->v_length);
|
||||
nv->v_compdata = TMALLOC(ngcomplex_t, v->v_length);
|
||||
bcopy(v->v_compdata, nv->v_compdata,
|
||||
sizeof(ngcomplex_t) * v->v_length);
|
||||
}
|
||||
|
|
@ -979,7 +977,7 @@ vec_transpose(struct dvec *v)
|
|||
*/
|
||||
|
||||
if (isreal(v)) {
|
||||
newreal = (double *) tmalloc(sizeof (double) * v->v_length);
|
||||
newreal = TMALLOC(double, v->v_length);
|
||||
oldreal = v->v_realdata;
|
||||
koffset = 0;
|
||||
for ( k=0; k < nummatrices; k++ ) {
|
||||
|
|
@ -996,7 +994,7 @@ vec_transpose(struct dvec *v)
|
|||
tfree(oldreal);
|
||||
v->v_realdata = newreal;
|
||||
} else {
|
||||
newcomp = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * v->v_length);
|
||||
newcomp = TMALLOC(ngcomplex_t, v->v_length);
|
||||
oldcomp = v->v_compdata;
|
||||
koffset = 0;
|
||||
for ( k=0; k < nummatrices; k++ ) {
|
||||
|
|
@ -1064,10 +1062,10 @@ vec_mkfamily(struct dvec *v)
|
|||
d->v_length = size;
|
||||
|
||||
if (isreal(v)) {
|
||||
d->v_realdata = (double *) tmalloc(size * sizeof(double));
|
||||
d->v_realdata = TMALLOC(double, size);
|
||||
bcopy(v->v_realdata + size*j, d->v_realdata, size*sizeof(double));
|
||||
} else {
|
||||
d->v_compdata = (ngcomplex_t *) tmalloc(size * sizeof(ngcomplex_t));
|
||||
d->v_compdata = TMALLOC(ngcomplex_t, size);
|
||||
bcopy(v->v_compdata + size*j, d->v_compdata, size*sizeof(ngcomplex_t));
|
||||
}
|
||||
/* Add one to the counter. */
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ struct _keyed {
|
|||
};
|
||||
|
||||
|
||||
#define NEWGRAPH (GRAPH *) tmalloc(sizeof(GRAPH))
|
||||
#define NEWGRAPH TMALLOC(GRAPH, 1)
|
||||
|
||||
#define rnd(x) (int) ((x)+0.5)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ REVISIONS: Aug 21, 2009 - adapted for ngspice
|
|||
#include <bool.h>
|
||||
|
||||
#define _NGMALLOC(size_xz) tmalloc((size_xz))
|
||||
#define NGMALLOC(n, els) (els *) tmalloc((n)*sizeof(els))
|
||||
#define NGREALLOC(ar,n,els) (els *) trealloc(ar,(n)*sizeof(els))
|
||||
#define NGMALLOC(n, els) TMALLOC(els, n)
|
||||
#define NGREALLOC(ar,n,els) TREALLOC(els, ar, n)
|
||||
#define NGFREE(els) txfree(els)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@
|
|||
#define ABORT() fflush(stderr);fflush(stdout);abort();
|
||||
|
||||
#define MERROR(CODE,MESSAGE) { \
|
||||
errMsg = (char *) tmalloc(strlen(MESSAGE) + 1); \
|
||||
errMsg = TMALLOC(char, strlen(MESSAGE) + 1); \
|
||||
strcpy(errMsg, (MESSAGE)); \
|
||||
return (CODE); \
|
||||
}
|
||||
|
||||
#define NEW(TYPE) ((TYPE *) tmalloc(sizeof(TYPE)))
|
||||
#define NEWN(TYPE,COUNT) ((TYPE *) tmalloc(sizeof(TYPE) * (COUNT)))
|
||||
#define NEW(TYPE) (TMALLOC(TYPE, 1))
|
||||
#define NEWN(TYPE,COUNT) (TMALLOC(TYPE, COUNT))
|
||||
|
||||
|
||||
#define R_NORM(A,B) { \
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#define TMALLOC(t,n) (t*) /**/ tmalloc(sizeof(t) * (size_t)(n))
|
||||
#define TREALLOC(t,p,n) (t*) /**/ trealloc(p, sizeof(t) * (size_t)(n))
|
||||
|
||||
#ifndef HAVE_LIBGC
|
||||
extern void *tmalloc(size_t num);
|
||||
extern void *trealloc(void *str, size_t num);
|
||||
|
|
@ -21,10 +24,10 @@ extern void txfree(void *ptr);
|
|||
|
||||
#include "../misc/stringutil.h" /* va: spice3 internally bzero */
|
||||
|
||||
#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE)))
|
||||
#define alloc(TYPE) (TMALLOC(TYPE, 1))
|
||||
#define MALLOC(x) tmalloc((unsigned)(x))
|
||||
#define FREE(x) {if (x) {txfree((char *)(x));(x) = 0;}}
|
||||
#define REALLOC(x,y) trealloc((char *)(x),(unsigned)(y))
|
||||
#define REALLOC(x,y) trealloc((x),(unsigned)(y))
|
||||
#define ZERO(PTR,TYPE) (bzero((PTR),sizeof(TYPE)))
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ read_initialisation_file(char * dir, char * name)
|
|||
asprintf(&path, "%s" DIR_PATHSEP "%s", dir,name);
|
||||
if(path==NULL) return FALSE; /* memory allocation error */
|
||||
#else /* ~ HAVE_ASPRINTF */
|
||||
path=(char*)tmalloc(2 + strlen(dir)+strlen(name));
|
||||
path = TMALLOC(char, 2 + strlen(dir) + strlen(name));
|
||||
if(path==NULL) return FALSE; /* memory allocation error */
|
||||
sprintf(path,"%s" DIR_PATHSEP "%s",dir,name);
|
||||
#endif /* HAVE_ASPRINTF */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _CMATH_H
|
||||
#define _CMATH_H
|
||||
|
||||
#define alloc_c(len) ((ngcomplex_t *) tmalloc((len) * sizeof(ngcomplex_t)))
|
||||
#define alloc_d(len) ((double *) tmalloc((len) * sizeof (double)))
|
||||
#define alloc_c(len) (TMALLOC(ngcomplex_t, len))
|
||||
#define alloc_d(len) (TMALLOC(double, len))
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap)
|
|||
( *(ckt->CKTstate0+qcap) - *(ckt->CKTstate1+qcap) );
|
||||
break;
|
||||
default:
|
||||
errMsg = (char*) MALLOC(strlen(ordmsg)+1);
|
||||
errMsg = TMALLOC(char, strlen(ordmsg) + 1);
|
||||
strcpy(errMsg,ordmsg);
|
||||
return(E_ORDER);
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap)
|
|||
break;
|
||||
|
||||
default:
|
||||
errMsg = (char*) MALLOC(strlen(methodmsg)+1);
|
||||
errMsg = TMALLOC(char, strlen(methodmsg) + 1);
|
||||
strcpy(errMsg,methodmsg);
|
||||
return(E_METHOD);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
}
|
||||
}
|
||||
|
||||
/* OldCKTstate0=(double *)MALLOC((ckt->CKTnumStates+1)*sizeof(double)); */
|
||||
/* OldCKTstate0=TMALLOC(double, ckt->CKTnumStates + 1); */
|
||||
|
||||
for(;;){
|
||||
ckt->CKTnoncon=0;
|
||||
|
|
@ -122,7 +122,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
* wrong - so we ask for the troublesome entry
|
||||
*/
|
||||
SMPgetError(ckt->CKTmatrix,&i,&j);
|
||||
message = (char *)MALLOC(1000); /* should be enough */
|
||||
message = TMALLOC(char, 1000); /* should be enough */
|
||||
(void)sprintf(message,
|
||||
"singular matrix: check nodes %s and %s\n",
|
||||
NODENAME(ckt,i),NODENAME(ckt,j));
|
||||
|
|
@ -162,7 +162,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
/*moved it to here as if xspice is included then CKTload changes
|
||||
CKTnumStates the first time it is run */
|
||||
if(!OldCKTstate0)
|
||||
OldCKTstate0=(double *)MALLOC((ckt->CKTnumStates+1)*sizeof(double));
|
||||
OldCKTstate0=TMALLOC(double, ckt->CKTnumStates + 1);
|
||||
for(i=0;i<ckt->CKTnumStates;i++) {
|
||||
*(OldCKTstate0+i) = *(ckt->CKTstate0+i);
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ NIiter(CKTcircuit *ckt, int maxIter)
|
|||
/*fprintf(stderr,"too many iterations without convergence: %d iter's (max iter == %d)\n",
|
||||
iterno,maxIter);*/
|
||||
ckt->CKTstat->STATnumIter += iterno;
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
strcpy(errMsg,msg);
|
||||
#ifdef STEPDEBUG
|
||||
printf("iterlim exceeded \n");
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
#define CKALLOC(ptr,size,type) if(( ckt->ptr =\
|
||||
(type *) MALLOC((size)*sizeof(type))) == NULL) return(E_NOMEM);
|
||||
TMALLOC(type, size)) == NULL) return(E_NOMEM);
|
||||
|
||||
int
|
||||
NIreinit( CKTcircuit *ckt)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
#define CKALLOC(ptr,size,type) if(( ckt->ptr =\
|
||||
(type *) MALLOC((size)*sizeof(type))) == NULL) return(E_NOMEM);
|
||||
TMALLOC(type, size)) == NULL) return(E_NOMEM);
|
||||
|
||||
int
|
||||
NIsenReinit(CKTcircuit *ckt)
|
||||
|
|
|
|||
|
|
@ -55,11 +55,10 @@ ft_interpolate(double *data, double *ndata, double *oscale, int olen,
|
|||
else
|
||||
sign = 1;
|
||||
|
||||
scratch = (double *) tmalloc(((degree + 1) * (degree + 2)) *
|
||||
sizeof (double));
|
||||
result = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
xdata = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
ydata = (double *) tmalloc((degree + 1) * sizeof (double));
|
||||
scratch = TMALLOC(double, (degree + 1) * (degree + 2));
|
||||
result = TMALLOC(double, degree + 1);
|
||||
xdata = TMALLOC(double, degree + 1);
|
||||
ydata = TMALLOC(double, degree + 1);
|
||||
|
||||
/* Deal with the first degree pieces. */
|
||||
bcopy(data, ydata, (degree + 1) * sizeof (double));
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ extern void * trealloc(void *, size_t);
|
|||
|
||||
#define SP_MALLOC(type,number) ((type *)tmalloc((size_t)(sizeof(type)*(number))))
|
||||
#define SP_REALLOC(ptr,type,number) \
|
||||
ptr = (type *)trealloc((char *)ptr,(unsigned)(sizeof(type)*(number)))
|
||||
ptr = (type *)trealloc(ptr,(unsigned)(sizeof(type)*(number)))
|
||||
#define SP_FREE(ptr) { if ((ptr) != NULL) txfree((char *)(ptr)); (ptr) = NULL; }
|
||||
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ extern void * trealloc(void *, size_t);
|
|||
}
|
||||
#else /* HAVE_LIBCG */
|
||||
#define SP_CALLOC(ptr,type,number) \
|
||||
{ ptr = (type *) tmalloc(((size_t)number) * sizeof(type)); \
|
||||
{ ptr = TMALLOC(type, (size_t)number); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ DESCRIPTION:This file contains the routines for manipulating dynamic strings.
|
|||
CONTENTS:
|
||||
DATE: Wed Mar 24 18:38:28 CDT 2010
|
||||
REVISIONS: $Log$
|
||||
REVISIONS: Revision 1.3 2010-10-09 11:42:10 rlar
|
||||
REVISIONS: Revision 1.4 2010-10-28 19:32:34 rlar
|
||||
REVISIONS: wrap tmalloc MALLOC etc, into two macros TMALLOC and TREALLOC
|
||||
REVISIONS:
|
||||
REVISIONS: Revision 1.3 2010/10/09 11:42:10 rlar
|
||||
REVISIONS: remove #define for EOS use '\0' instead
|
||||
REVISIONS:
|
||||
REVISIONS: Revision 1.2 2010/07/01 19:52:26 rlar
|
||||
|
|
@ -90,7 +93,7 @@ char *spice_dstring_append(SPICE_DSTRINGPTR dsPtr,char *string,int length)
|
|||
----------------------------------------------------------------- */
|
||||
if (newSize >= dsPtr->spaceAvl) {
|
||||
dsPtr->spaceAvl = 2 * newSize ;
|
||||
newString = (char*) tmalloc( dsPtr->spaceAvl * sizeof(char) ) ;
|
||||
newString = TMALLOC(char, dsPtr->spaceAvl) ;
|
||||
memcpy((void *) newString, (void *) dsPtr->string, (size_t) dsPtr->length) ;
|
||||
if (dsPtr->string != dsPtr->staticSpace) {
|
||||
txfree(dsPtr->string) ;
|
||||
|
|
@ -279,7 +282,7 @@ char *_spice_dstring_setlength(SPICE_DSTRINGPTR dsPtr,int length)
|
|||
if (length >= dsPtr->spaceAvl) {
|
||||
|
||||
dsPtr->spaceAvl = length+1;
|
||||
newString = (char*) tmalloc( dsPtr->spaceAvl * sizeof(char) ) ;
|
||||
newString = TMALLOC(char, dsPtr->spaceAvl) ;
|
||||
/* -----------------------------------------------------------------
|
||||
* SPECIAL NOTE: must use memcpy, not strcpy, to copy the string
|
||||
* to a larger buffer, since there may be embedded NULLs in the
|
||||
|
|
|
|||
|
|
@ -45,13 +45,12 @@ mkvar(char **p, char *path_prefix, char *var_dir, char *env_var)
|
|||
asprintf(p, "%s%s%s", path_prefix, DIR_PATHSEP, var_dir);
|
||||
#else /* ~ HAVE_ASPRINTF */
|
||||
if (buffer){
|
||||
*p = (char *) tmalloc(strlen(buffer)+1);
|
||||
*p = TMALLOC(char, strlen(buffer) + 1);
|
||||
sprintf(*p,"%s",buffer);
|
||||
/* asprintf(p, "%s", buffer); */
|
||||
}
|
||||
else{
|
||||
*p = (char *) tmalloc(strlen(path_prefix) +
|
||||
strlen(DIR_PATHSEP) + strlen(var_dir) + 1);
|
||||
*p = TMALLOC(char, strlen(path_prefix) + strlen(DIR_PATHSEP) + strlen(var_dir) + 1);
|
||||
sprintf(*p, "%s%s%s", path_prefix, DIR_PATHSEP, var_dir);
|
||||
/* asprintf(p, "%s%s%s", path_prefix, DIR_PATHSEP, var_dir); */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ smktemp(char *id)
|
|||
id = "sp";
|
||||
|
||||
sprintf(rbuf, TEMPFORMAT, id, num);
|
||||
nbuf = (char *) tmalloc(strlen(rbuf) + 1);
|
||||
nbuf = TMALLOC(char, strlen(rbuf) + 1);
|
||||
strcpy(nbuf, rbuf);
|
||||
|
||||
return nbuf;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ copy(const char *str)
|
|||
{
|
||||
char *p;
|
||||
|
||||
if ((p = (char*) tmalloc(strlen(str) + 1)))
|
||||
if ((p = TMALLOC(char, strlen(str) + 1)))
|
||||
(void) strcpy(p, str);
|
||||
return(p);
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ copy_substring(const char *str, const char *end)
|
|||
int n = end - str;
|
||||
char *p;
|
||||
|
||||
if ((p = (char*) tmalloc(n + 1))) {
|
||||
if ((p = TMALLOC(char, n + 1))) {
|
||||
(void) strncpy(p, str, n);
|
||||
p[n] = '\0';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ char * absolute_pathname(char *string, char *dot_path)
|
|||
result = copy(string);
|
||||
else {
|
||||
if (dot_path && dot_path[0]) {
|
||||
result = (char*) tmalloc(2 + strlen(dot_path) + strlen(string));
|
||||
result = TMALLOC(char, 2 + strlen(dot_path) + strlen(string));
|
||||
strcpy(result, dot_path);
|
||||
result_len = strlen(result);
|
||||
if (result[result_len - 1] != '/') {
|
||||
|
|
@ -135,7 +135,7 @@ char * absolute_pathname(char *string, char *dot_path)
|
|||
result[result_len] = '\0';
|
||||
}
|
||||
} else {
|
||||
result = (char*) tmalloc(3 + strlen (string));
|
||||
result = TMALLOC(char, 3 + strlen (string));
|
||||
result[0] = '.'; result[1] = '/'; result[2] = '\0';
|
||||
result_len = 2;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ basename(const char *name)
|
|||
len = strlen(name);
|
||||
if (name[len - 1] == '/') {
|
||||
// ditch the trailing '/'
|
||||
p = tmp = (char*) tmalloc(len);
|
||||
p = tmp = TMALLOC(char, len);
|
||||
strncpy(p, name, len - 1);
|
||||
} else {
|
||||
p = (char *) name;
|
||||
|
|
@ -221,7 +221,7 @@ dirname(const char *name)
|
|||
|
||||
size = p - name;
|
||||
if (size) {
|
||||
ret = (char*) tmalloc(size + 1);
|
||||
ret = TMALLOC(char, size + 1);
|
||||
memcpy(ret, name, size);
|
||||
ret[size] = '\0';
|
||||
} else if (*p == '/')
|
||||
|
|
@ -266,7 +266,7 @@ dirname(const char *name)
|
|||
|
||||
size = p - name;
|
||||
if (size) {
|
||||
ret = (char*) tmalloc(size + 1);
|
||||
ret = TMALLOC(char, size + 1);
|
||||
memcpy(ret, name, size);
|
||||
ret[size] = '\0';
|
||||
} else if (*p == '/')
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ wl_mkvec(wordlist *wl)
|
|||
char **v;
|
||||
|
||||
len = wl_length(wl);
|
||||
v = (char **) tmalloc((len + 1) * sizeof (char *));
|
||||
v = TMALLOC(char *, len + 1);
|
||||
for (i = 0; i < len; i++) {
|
||||
v[i] = copy(wl->wl_word);
|
||||
wl = wl->wl_next;
|
||||
|
|
@ -198,7 +198,7 @@ wl_flatten(wordlist *wl)
|
|||
|
||||
for (tw = wl; tw; tw = tw->wl_next)
|
||||
i += strlen(tw->wl_word) + 1;
|
||||
buf = (char*) tmalloc(i + 1);
|
||||
buf = TMALLOC(char, i + 1);
|
||||
*buf = 0;
|
||||
|
||||
while (wl != NULL) {
|
||||
|
|
@ -245,7 +245,7 @@ wl_sort(wordlist *wl)
|
|||
ww = ww->wl_next;
|
||||
if (i < 2)
|
||||
return;
|
||||
stuff = (char **) tmalloc(i * sizeof (char *));
|
||||
stuff = TMALLOC(char *, i);
|
||||
for (i = 0, ww = wl; ww; i++, ww = ww->wl_next)
|
||||
stuff[i] = ww->wl_word;
|
||||
qsort(stuff, i, sizeof (char *), wlcomp);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ main (int argc, char **argv)
|
|||
|
||||
switch (ch) {
|
||||
case 'o':
|
||||
name = (char *) tmalloc(strlen(optarg)*sizeof(char));
|
||||
name = TMALLOC(char, strlen(optarg));
|
||||
(void) strcpy(name,optarg);
|
||||
gotname=1;
|
||||
use_opt = 1;
|
||||
|
|
@ -158,13 +158,13 @@ main (int argc, char **argv)
|
|||
|
||||
comments(r,l,g,c,ctot,cm,lm,k,name,num,len);
|
||||
|
||||
matrix = (double **) tmalloc(sizeof(double*)*(num+1));
|
||||
inverse = (double **) tmalloc(sizeof(double*)*(num+1));
|
||||
tpeigenvalues = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
matrix = TMALLOC(double *, num + 1);
|
||||
inverse = TMALLOC(double *, num + 1);
|
||||
tpeigenvalues = TMALLOC(double, num + 1);
|
||||
|
||||
for (i=1;i<=num;i++) {
|
||||
matrix[i] = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
inverse[i] = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
matrix[i] = TMALLOC(double, num + 1);
|
||||
inverse[i] = TMALLOC(double, num + 1);
|
||||
}
|
||||
|
||||
for (i=1;i<=num;i++) {
|
||||
|
|
@ -176,7 +176,7 @@ main (int argc, char **argv)
|
|||
matrix[i][j] = phi(i-1,tpeigenvalues[j]);
|
||||
}
|
||||
}
|
||||
gammaj = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
gammaj = TMALLOC(double, num + 1);
|
||||
|
||||
for (j=1;j<=num;j++) {
|
||||
gammaj[j] = 0.0;
|
||||
|
|
@ -203,10 +203,10 @@ main (int argc, char **argv)
|
|||
int errflg, err, singular_row, singular_col;
|
||||
double *elptr;
|
||||
|
||||
rhs = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
irhs = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
solution = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
isolution = (double *) tmalloc(sizeof(double)*(num+1));
|
||||
rhs = TMALLOC(double, num + 1);
|
||||
irhs = TMALLOC(double, num + 1);
|
||||
solution = TMALLOC(double, num + 1);
|
||||
isolution = TMALLOC(double, num + 1);
|
||||
|
||||
othermatrix = spCreate(num,0,&errflg);
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ main (int argc, char **argv)
|
|||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"* Lossy line models\n");
|
||||
|
||||
options = (char *) tmalloc(256);
|
||||
options = TMALLOC(char, 256);
|
||||
(void) strcpy(options,"rel=1.2 nocontrol");
|
||||
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",
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ main(void) {
|
|||
char *filename;
|
||||
|
||||
|
||||
filename = (char *)tmalloc(1024);
|
||||
typeline = (char *)tmalloc(1024);
|
||||
dataline = (char *)tmalloc(1024);
|
||||
filename = TMALLOC(char, 1024);
|
||||
typeline = TMALLOC(char, 1024);
|
||||
dataline = TMALLOC(char, 1024);
|
||||
|
||||
while(p == NULL) {
|
||||
printf("name of process file (input): ");
|
||||
|
|
@ -102,7 +102,7 @@ main(void) {
|
|||
}
|
||||
if(*typeline == 0) break;
|
||||
if(strncmp("nm",typeline,2) == 0) {
|
||||
ncur = (nmod *)tmalloc(sizeof(nmod));
|
||||
ncur = TMALLOC(nmod, 1);
|
||||
ncur->nnext = NULL;
|
||||
ncur->nname = typeline;
|
||||
*(typeline+3) = '\0';
|
||||
|
|
@ -111,7 +111,7 @@ main(void) {
|
|||
ncur->nnext = nlist;
|
||||
nlist = ncur;
|
||||
} else if(strncmp("pm",typeline,2) == 0) {
|
||||
pcur = (pmod *)tmalloc(sizeof(pmod));
|
||||
pcur = TMALLOC(pmod, 1);
|
||||
pcur->pnext = NULL;
|
||||
pcur->pname = typeline;
|
||||
*(typeline+3) = '\0';
|
||||
|
|
@ -120,7 +120,7 @@ main(void) {
|
|||
pcur->pnext = plist;
|
||||
plist = pcur;
|
||||
} else if(strncmp("py",typeline,2) == 0) {
|
||||
ycur = (ymod *)tmalloc(sizeof(ymod));
|
||||
ycur = TMALLOC(ymod, 1);
|
||||
ycur->ynext = NULL;
|
||||
ycur->yname = typeline;
|
||||
*(typeline+3) = '\0';
|
||||
|
|
@ -129,7 +129,7 @@ main(void) {
|
|||
ycur->ynext = ylist;
|
||||
ylist = ycur;
|
||||
} else if(strncmp("du",typeline,2) == 0) {
|
||||
dcur = (dmod *)tmalloc(sizeof(dmod));
|
||||
dcur = TMALLOC(dmod, 1);
|
||||
dcur->dnext = NULL;
|
||||
dcur->dname = typeline;
|
||||
*(typeline+3) = '\0';
|
||||
|
|
@ -138,7 +138,7 @@ main(void) {
|
|||
dcur->dnext = dlist;
|
||||
dlist = dcur;
|
||||
} else if(strncmp("ml",typeline,2) == 0) {
|
||||
mcur = (mmod *)tmalloc(sizeof(mmod));
|
||||
mcur = TMALLOC(mmod, 1);
|
||||
mcur->mnext = NULL;
|
||||
mcur->mname = typeline;
|
||||
*(typeline+3) = '\0';
|
||||
|
|
|
|||
|
|
@ -176,11 +176,9 @@ oldread(char *name)
|
|||
for (v = pl->pl_dvecs; v; v = v->v_next) {
|
||||
v->v_length = np;
|
||||
if (isreal(v)) {
|
||||
v->v_realdata = (double *) tmalloc(sizeof (double)
|
||||
* np);
|
||||
v->v_realdata = TMALLOC(double, np);
|
||||
} else {
|
||||
v->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t)
|
||||
* np);
|
||||
v->v_compdata = TMALLOC(ngcomplex_t, np);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < np; i++) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ CKTacDump(CKTcircuit *ckt, double freq, void *plot)
|
|||
irhsold = ckt->CKTirhsOld;
|
||||
freqData.rValue = freq;
|
||||
valueData.v.numValue = ckt->CKTmaxEqNum-1;
|
||||
data = (IFcomplex *) MALLOC((ckt->CKTmaxEqNum-1)*sizeof(IFcomplex));
|
||||
data = TMALLOC(IFcomplex, ckt->CKTmaxEqNum - 1);
|
||||
valueData.v.vec.cVec = data;
|
||||
for (i=0;i<ckt->CKTmaxEqNum-1;i++) {
|
||||
data[i].real = rhsold[i+1];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ CKTclrBreak(CKTcircuit *ckt)
|
|||
int j;
|
||||
|
||||
if(ckt->CKTbreakSize >2) {
|
||||
tmp = (double *)MALLOC((ckt->CKTbreakSize-1)*sizeof(double));
|
||||
tmp = TMALLOC(double, ckt->CKTbreakSize - 1);
|
||||
if(tmp == (double *)NULL) return(E_NOMEM);
|
||||
for(j=1;j<ckt->CKTbreakSize;j++) {
|
||||
*(tmp+j-1) = *(ckt->CKTbreaks+j);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CKTground(CKTcircuit *inCkt, CKTnode **node, IFuid name)
|
|||
ckt->CKTnodes->type = SP_VOLTAGE;
|
||||
ckt->CKTnodes->number = 0;
|
||||
} else {
|
||||
ckt->CKTnodes = (CKTnode *)MALLOC(sizeof(CKTnode));
|
||||
ckt->CKTnodes = TMALLOC(CKTnode, 1);
|
||||
if(ckt->CKTnodes == NULL) return(E_NOMEM);
|
||||
ckt->CKTnodes->name = name;
|
||||
ckt->CKTnodes->type = SP_VOLTAGE;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ int
|
|||
CKTlinkEq(CKTcircuit *ckt, CKTnode *node)
|
||||
{
|
||||
if(!(ckt->CKTnodes)) { /* starting the list - allocate both ground and 1 */
|
||||
ckt->CKTnodes = (CKTnode *) MALLOC(sizeof(CKTnode));
|
||||
ckt->CKTnodes = TMALLOC(CKTnode, 1);
|
||||
if(ckt->CKTnodes == (CKTnode *)NULL) return(E_NOMEM);
|
||||
ckt->CKTnodes->name = (char *)NULL;
|
||||
ckt->CKTnodes->type = SP_VOLTAGE;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CKTmkNode(CKTcircuit *ckt, CKTnode **node)
|
|||
{
|
||||
CKTnode *mynode;
|
||||
|
||||
mynode = (CKTnode *)MALLOC(sizeof(CKTnode));
|
||||
mynode = TMALLOC(CKTnode, 1);
|
||||
if(mynode == (CKTnode *)NULL) return(E_NOMEM);
|
||||
mynode->next = (CKTnode *)NULL;
|
||||
mynode->name = (IFuid) 0;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CKTnames(CKTcircuit *ckt, int *numNames, IFuid **nameList)
|
|||
CKTnode *here;
|
||||
int i;
|
||||
*numNames = ckt->CKTmaxEqNum-1;
|
||||
*nameList = (IFuid *)MALLOC(*numNames * sizeof(IFuid ));
|
||||
*nameList = TMALLOC(IFuid, *numNames);
|
||||
if ((*nameList) == (IFuid *)NULL) return(E_NOMEM);
|
||||
i=0;
|
||||
for (here = ckt->CKTnodes->next; here; here = here->next) {
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ CKTnewNode(CKTcircuit *inCkt, CKTnode **node, IFuid name)
|
|||
{
|
||||
CKTcircuit *ckt = /* fixme, drop that */ inCkt;
|
||||
if(!(ckt->CKTnodes)) { /* starting the list - allocate both ground and 1 */
|
||||
ckt->CKTnodes = (CKTnode *) MALLOC(sizeof(CKTnode));
|
||||
ckt->CKTnodes = TMALLOC(CKTnode, 1);
|
||||
if(ckt->CKTnodes == (CKTnode *)NULL) return(E_NOMEM);
|
||||
ckt->CKTnodes->name = (char *)NULL;
|
||||
ckt->CKTnodes->type = SP_VOLTAGE;
|
||||
ckt->CKTnodes->number = 0;
|
||||
ckt->CKTlastNode = ckt->CKTnodes;
|
||||
}
|
||||
ckt->CKTlastNode->next = (CKTnode *)MALLOC(sizeof(CKTnode));
|
||||
ckt->CKTlastNode->next = TMALLOC(CKTnode, 1);
|
||||
if(ckt->CKTlastNode->next == (CKTnode *)NULL) return(E_NOMEM);
|
||||
ckt->CKTlastNode = ckt->CKTlastNode->next;
|
||||
ckt->CKTlastNode->name = name;
|
||||
|
|
|
|||
|
|
@ -51,14 +51,12 @@ CKTnoise (CKTcircuit *ckt, int mode, int operation, Ndata *data)
|
|||
|
||||
case N_DENS:
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
|
||||
(*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL, "onoise_spectrum", UID_OTHER, NULL);
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
|
||||
(*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL, "inoise_spectrum", UID_OTHER, NULL);
|
||||
|
|
@ -66,24 +64,22 @@ CKTnoise (CKTcircuit *ckt, int mode, int operation, Ndata *data)
|
|||
/* we've added two more plots */
|
||||
|
||||
data->outpVector =
|
||||
(double *)MALLOC(data->numPlots * sizeof(double));
|
||||
TMALLOC(double, data->numPlots);
|
||||
break;
|
||||
|
||||
case INT_NOIZ:
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL, "onoise_total", UID_OTHER, NULL);
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt, &(data->namelist[data->numPlots++]),
|
||||
(IFuid)NULL, "inoise_total", UID_OTHER, NULL);
|
||||
/* we've added two more plots */
|
||||
|
||||
data->outpVector =
|
||||
(double *) MALLOC(data->numPlots * sizeof(double));
|
||||
TMALLOC(double, data->numPlots);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ CKTnewTask(CKTcircuit *ckt, TSKtask **taskPtr, IFuid taskName, TSKtask **defPtr)
|
|||
{
|
||||
TSKtask *tsk, *def=NULL;
|
||||
|
||||
*taskPtr = (TSKtask *)tmalloc(sizeof(TSKtask));
|
||||
*taskPtr = TMALLOC(TSKtask, 1);
|
||||
if(*taskPtr==NULL) return(E_NOMEM);
|
||||
tsk = *taskPtr;
|
||||
tsk->TSKname = taskName;
|
||||
|
|
|
|||
|
|
@ -169,9 +169,9 @@ dynamic_gmin (CKTcircuit * ckt, long int firstmode,
|
|||
for (n = ckt->CKTnodes; n; n = n->next)
|
||||
NumNodes++;
|
||||
|
||||
OldRhsOld = (double *) MALLOC ((NumNodes + 1) * sizeof (double));
|
||||
OldRhsOld = TMALLOC(double, NumNodes + 1);
|
||||
OldCKTstate0 =
|
||||
(double *) MALLOC ((ckt->CKTnumStates + 1) * sizeof (double));
|
||||
TMALLOC(double, ckt->CKTnumStates + 1);
|
||||
|
||||
for (n = ckt->CKTnodes; n; n = n->next)
|
||||
*(ckt->CKTrhsOld + n->number) = 0;
|
||||
|
|
@ -406,9 +406,9 @@ gillespie_src (CKTcircuit * ckt, long int firstmode,
|
|||
NumNodes++;
|
||||
}
|
||||
|
||||
OldRhsOld = (double *) MALLOC ((NumNodes + 1) * sizeof (double));
|
||||
OldRhsOld = TMALLOC(double, NumNodes + 1);
|
||||
OldCKTstate0 =
|
||||
(double *) MALLOC ((ckt->CKTnumStates + 1) * sizeof (double));
|
||||
TMALLOC(double, ckt->CKTnumStates + 1);
|
||||
|
||||
for (n = ckt->CKTnodes; n; n = n->next)
|
||||
*(ckt->CKTrhsOld + n->number) = 0;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ CKTsetBreak(CKTcircuit *ckt, double time)
|
|||
return(OK);
|
||||
}
|
||||
/* fits in middle - new array & insert */
|
||||
tmp = (double *)MALLOC((ckt->CKTbreakSize+1)*sizeof(double));
|
||||
tmp = TMALLOC(double, ckt->CKTbreakSize + 1);
|
||||
if(tmp == (double *)NULL) return(E_NOMEM);
|
||||
for(j=0;j<i;j++) {
|
||||
*(tmp+j) = *(ckt->CKTbreaks+j);
|
||||
|
|
@ -83,8 +83,7 @@ CKTsetBreak(CKTcircuit *ckt, double time)
|
|||
return(OK);
|
||||
}
|
||||
/* fits at end - grow array & add on */
|
||||
ckt->CKTbreaks = (double *)REALLOC(ckt->CKTbreaks,
|
||||
(ckt->CKTbreakSize+1)*sizeof(double));
|
||||
ckt->CKTbreaks = TREALLOC(double, ckt->CKTbreaks, ckt->CKTbreakSize + 1);
|
||||
ckt->CKTbreakSize++;
|
||||
ckt->CKTbreaks[ckt->CKTbreakSize-1]=time;
|
||||
#ifdef TRACE_BREAKPOINT
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
#define CKALLOC(var,size,type) \
|
||||
if(size && (!(var =(type *)MALLOC((size)*sizeof(type))))){\
|
||||
if(size && (!(var = TMALLOC(type, size)))){\
|
||||
return(E_NOMEM);\
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ CKTsetup(CKTcircuit *ckt)
|
|||
/* Allocate space for the matrix diagonal data */
|
||||
if(num_nodes > 0) {
|
||||
ckt->enh->rshunt_data.diag =
|
||||
(double **) MALLOC(num_nodes * sizeof(double *));
|
||||
TMALLOC(double *, num_nodes);
|
||||
}
|
||||
|
||||
/* Set the number of nodes in the rshunt data */
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ CKTtrouble(CKTcircuit *cktp, char *optmsg)
|
|||
sprintf(msg_p, "cause unrecorded.\n");
|
||||
}
|
||||
|
||||
emsg = (char*) MALLOC(strlen(msg_buf)+1);
|
||||
emsg = TMALLOC(char, strlen(msg_buf) + 1);
|
||||
strcpy(emsg,msg_buf);
|
||||
|
||||
return emsg;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int CLUsetup(CKTcircuit *ckt){
|
|||
|
||||
/* allocate the input connections */
|
||||
for(i=0;i<connections;i++) {
|
||||
curr = (struct input_pipe *)tmalloc(sizeof(struct input_pipe));
|
||||
curr = TMALLOC(struct input_pipe, 1);
|
||||
if(input_pipes)
|
||||
curr->next = input_pipes;
|
||||
else
|
||||
|
|
@ -132,7 +132,7 @@ static int setup_output(CKTcircuit *ckt){
|
|||
int sock,nodeNum,i;
|
||||
|
||||
/*Create the struct*/
|
||||
curr = (struct output_pipe *)tmalloc(sizeof(struct output_pipe));
|
||||
curr = TMALLOC(struct output_pipe, 1);
|
||||
if(output_pipes)
|
||||
curr->next = output_pipes;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ DCtran(CKTcircuit *ckt,
|
|||
/* end LTRA code addition */
|
||||
|
||||
if(ckt->CKTbreaks) FREE(ckt->CKTbreaks);
|
||||
ckt->CKTbreaks=(double *)MALLOC(2*sizeof(double));
|
||||
ckt->CKTbreaks = TMALLOC(double, 2);
|
||||
if(ckt->CKTbreaks == (double *)NULL) return(E_NOMEM);
|
||||
*(ckt->CKTbreaks)=0;
|
||||
*(ckt->CKTbreaks+1)=ckt->CKTfinalTime;
|
||||
|
|
@ -358,8 +358,7 @@ nextTime:
|
|||
if (need < ckt->CKTsizeIncr)
|
||||
need = ckt->CKTsizeIncr;
|
||||
ckt->CKTtimeListSize += need;
|
||||
ckt->CKTtimePoints = (double *) REALLOC( (char *)
|
||||
ckt->CKTtimePoints, sizeof(double) * ckt->CKTtimeListSize);
|
||||
ckt->CKTtimePoints = TREALLOC(double, ckt->CKTtimePoints, ckt->CKTtimeListSize);
|
||||
ckt->CKTsizeIncr *= 1.4;
|
||||
}
|
||||
*(ckt->CKTtimePoints + ckt->CKTtimeIndex) = ckt->CKTtime;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ c = *a;
|
|||
static void
|
||||
DmemAlloc(double **a, int size)
|
||||
{
|
||||
*a = (double *) MALLOC( sizeof(double) * (size + 1));
|
||||
*a = TMALLOC(double, size + 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ DmemAlloc(double **a, int size)
|
|||
static void
|
||||
DstorAlloc(double ***header, int size)
|
||||
{
|
||||
*header = (double **) MALLOC( sizeof(double *)*size);
|
||||
*header = TMALLOC(double *, size);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -420,7 +420,7 @@ printf("Time outside D_2F1MF2: %g seconds \n", time);
|
|||
}
|
||||
else
|
||||
{
|
||||
errMsg = (char*) MALLOC(strlen(nof2src)+1);
|
||||
errMsg = TMALLOC(char, strlen(nof2src) + 1);
|
||||
strcpy(errMsg,nof2src);
|
||||
return(E_NOF2SRC);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
error = CKTfndDev(ckt, &code, &inst,
|
||||
job->input, (GENmodel *)NULL, (IFuid)NULL);
|
||||
if (!error && !((VSRCinstance *)inst)->VSRCacGiven) {
|
||||
errMsg = (char*) MALLOC(strlen(noacinput)+1);
|
||||
errMsg = TMALLOC(char, strlen(noacinput) + 1);
|
||||
strcpy(errMsg,noacinput);
|
||||
return (E_NOACINPUT);
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
return (E_NOTFOUND);
|
||||
}
|
||||
if (!((ISRCinstance *)inst)->ISRCacGiven) {
|
||||
errMsg = (char*) MALLOC(strlen(noacinput)+1);
|
||||
errMsg = TMALLOC(char, strlen(noacinput) + 1);
|
||||
strcpy(errMsg,noacinput);
|
||||
return (E_NOACINPUT);
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
error = CKTload(ckt);
|
||||
if(error) return(error);
|
||||
|
||||
data = (Ndata*)MALLOC(sizeof(Ndata));
|
||||
data = TMALLOC(Ndata, 1);
|
||||
step = 0;
|
||||
data->freq = job->NstartFreq;
|
||||
data->outNoiz = 0.0;
|
||||
|
|
|
|||
|
|
@ -130,10 +130,8 @@ PZpost(CKTcircuit *ckt)
|
|||
char name[50];
|
||||
int i, j;
|
||||
|
||||
namelist = (IFuid *) MALLOC((pzan->PZnPoles
|
||||
+ pzan->PZnZeros)*sizeof(IFuid));
|
||||
out_list = (IFcomplex *)MALLOC((pzan->PZnPoles
|
||||
+ pzan->PZnZeros)*sizeof(IFcomplex));
|
||||
namelist = TMALLOC(IFuid, pzan->PZnPoles + pzan->PZnZeros);
|
||||
out_list = TMALLOC(IFcomplex, pzan->PZnPoles + pzan->PZnZeros);
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < pzan->PZnPoles; i++) {
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ TFanal(CKTcircuit *ckt, int restart)
|
|||
(*(SPfrontEnd->IFnewUid))(ckt,&outuid,((TFan*)ckt->CKTcurJob)->TFoutSrc
|
||||
,"Output_impedance", UID_OTHER, NULL);
|
||||
} else {
|
||||
name = (char *)
|
||||
MALLOC(sizeof(char)*(strlen(((TFan*)ckt->CKTcurJob)->TFoutName)+22));
|
||||
name = TMALLOC(char, strlen(((TFan*)ckt->CKTcurJob)->TFoutName) + 22);
|
||||
(void)sprintf(name,"output_impedance_at_%s",
|
||||
((TFan*)ckt->CKTcurJob)->TFoutName);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,&outuid,(IFuid)NULL,
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ if((here->ptr = SMPmakeElt(matrix, here->first, (second)->number))\
|
|||
return(E_UNSUPP);
|
||||
}
|
||||
|
||||
here->ASRCposptr = (double **)
|
||||
REALLOC(here->ASRCposptr, sizeof(double *)*(j+5));
|
||||
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 5);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCposNode,ASRCbranch);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCnegNode,ASRCbranch);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCbranch,ASRCnegNode);
|
||||
|
|
@ -98,14 +97,12 @@ if((here->ptr = SMPmakeElt(matrix, here->first, (second)->number))\
|
|||
TSTALLOC(ASRCposptr[j++],ASRCbranch,ASRCcont_br);
|
||||
v_first = 0;
|
||||
} else{
|
||||
here->ASRCposptr = (double **)
|
||||
REALLOC(here->ASRCposptr, sizeof(double *)*(j+1));
|
||||
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCbranch,ASRCcont_br);
|
||||
}
|
||||
} else if(here->ASRCtype == ASRC_CURRENT){
|
||||
/* CCCS */
|
||||
here->ASRCposptr = (double **)
|
||||
REALLOC(here->ASRCposptr, sizeof(double *) * (j+2));
|
||||
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCposNode,ASRCcont_br);
|
||||
TSTALLOC(ASRCposptr[j++],ASRCnegNode,ASRCcont_br);
|
||||
} else{
|
||||
|
|
@ -119,14 +116,12 @@ if((here->ptr = SMPmakeElt(matrix, here->first, (second)->number))\
|
|||
MY_TSTALLOC(ASRCposptr[j++],ASRCbranch,here->ASRCtree->vars[i].nValue);
|
||||
v_first = 0;
|
||||
} else{
|
||||
here->ASRCposptr = (double **)
|
||||
REALLOC(here->ASRCposptr, sizeof(double *) * (j+1));
|
||||
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1);
|
||||
MY_TSTALLOC(ASRCposptr[j++],ASRCbranch,here->ASRCtree->vars[i].nValue);
|
||||
}
|
||||
} else if(here->ASRCtype == ASRC_CURRENT){
|
||||
/* VCCS */
|
||||
here->ASRCposptr = (double **)
|
||||
REALLOC(here->ASRCposptr, sizeof(double *) * (j+2));
|
||||
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2);
|
||||
MY_TSTALLOC(ASRCposptr[j++],ASRCposNode,here->ASRCtree->vars[i].nValue);
|
||||
MY_TSTALLOC(ASRCposptr[j++],ASRCnegNode,here->ASRCtree->vars[i].nValue);
|
||||
} else{
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue
|
|||
return(OK);
|
||||
case BJT_QUEST_CS :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJTask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKCURRENT);
|
||||
|
|
@ -243,7 +243,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue
|
|||
return(OK);
|
||||
case BJT_QUEST_CE :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJTask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKCURRENT);
|
||||
|
|
@ -258,7 +258,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue
|
|||
return(OK);
|
||||
case BJT_QUEST_POWER :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJTask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKPOWER);
|
||||
|
|
|
|||
|
|
@ -70,9 +70,7 @@ BJTnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
inst->BJTname,BJTnNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)
|
||||
trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -86,9 +84,7 @@ BJTnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"onoise_total_%s%s",
|
||||
inst->BJTname,BJTnNames[i]);
|
||||
|
||||
data->namelist = (IFuid *)
|
||||
trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -98,7 +94,7 @@ BJTnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"inoise_total_%s%s",
|
||||
inst->BJTname,BJTnNames[i]);
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ BJTsSetup(SENstruct *info, GENmodel *inModel)
|
|||
here->BJTsenParmNo = ++(info->SENparms);
|
||||
here->BJTsenPertFlag = OFF;
|
||||
}
|
||||
if((here->BJTsens = (double *)MALLOC(55*sizeof(double))) ==
|
||||
if((here->BJTsens = TMALLOC(double, 55)) ==
|
||||
NULL) return(E_NOMEM);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value,
|
|||
return(OK);
|
||||
case BJT2_QUEST_CS :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJT2ask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKCURRENT);
|
||||
|
|
@ -259,7 +259,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value,
|
|||
return(OK);
|
||||
case BJT2_QUEST_CE :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJT2ask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKCURRENT);
|
||||
|
|
@ -278,7 +278,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value,
|
|||
return(OK);
|
||||
case BJT2_QUEST_POWER :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
errMsg = (char*) MALLOC(strlen(msg)+1);
|
||||
errMsg = TMALLOC(char, strlen(msg) + 1);
|
||||
errRtn = "BJT2ask";
|
||||
strcpy(errMsg,msg);
|
||||
return(E_ASKPOWER);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@ BJT2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
inst->BJT2name,BJT2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)
|
||||
trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -84,9 +82,7 @@ BJT2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"onoise_total_%s%s",
|
||||
inst->BJT2name,BJT2nNames[i]);
|
||||
|
||||
data->namelist = (IFuid *)
|
||||
trealloc((char *)data->namelist,
|
||||
(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -96,7 +92,7 @@ BJT2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"inoise_total_%s%s",
|
||||
inst->BJT2name,BJT2nNames[i]);
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ BJT2sSetup(SENstruct *info, GENmodel *inModel)
|
|||
here->BJT2senParmNo = ++(info->SENparms);
|
||||
here->BJT2senPertFlag = OFF;
|
||||
}
|
||||
if((here->BJT2sens = (double *)MALLOC(55*sizeof(double))) ==
|
||||
if((here->BJT2sens = TMALLOC(double, 55)) ==
|
||||
NULL) return(E_NOMEM);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ B1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"onoise_%s%s",inst->B1name,B1nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -79,7 +79,7 @@ if (!data->namelist) return(E_NOMEM);
|
|||
(void)sprintf(name,"onoise_total_%s%s",inst->B1name,B1nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -90,7 +90,7 @@ if (!data->namelist) return(E_NOMEM);
|
|||
(void)sprintf(name,"inoise_total_%s%s",inst->B1name,B1nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ B2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt,
|
|||
(void)sprintf(name,"onoise_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -79,7 +79,7 @@ if (!data->namelist) return(E_NOMEM);
|
|||
(void)sprintf(name,"onoise_total_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
@ -90,7 +90,7 @@ if (!data->namelist) return(E_NOMEM);
|
|||
(void)sprintf(name,"inoise_total_%s%s",inst->B2name,B2nNames[i]);
|
||||
|
||||
|
||||
data->namelist = (IFuid *)trealloc((char *)data->namelist,(data->numPlots + 1)*sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist) return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid))(ckt,
|
||||
&(data->namelist[data->numPlots++]),
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ B2temp(GENmodel *inModel, CKTcircuit *ckt)
|
|||
}
|
||||
|
||||
if (Size_Not_Found)
|
||||
{ here->pParam = (struct bsim2SizeDependParam *)tmalloc(
|
||||
sizeof(struct bsim2SizeDependParam));
|
||||
{ here->pParam = TMALLOC(struct bsim2SizeDependParam, 1);
|
||||
if (pLastKnot == NULL)
|
||||
model->pSizeDependParamKnot = here->pParam;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -154,10 +154,7 @@ int i;
|
|||
{ (void) sprintf(name, "onoise.%s%s",
|
||||
here->BSIM3name,
|
||||
BSIM3nNames[i]);
|
||||
data->namelist = (IFuid *) trealloc(
|
||||
(char *) data->namelist,
|
||||
(data->numPlots + 1)
|
||||
* sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist)
|
||||
return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid)) (ckt,
|
||||
|
|
@ -172,10 +169,7 @@ int i;
|
|||
{ (void) sprintf(name, "onoise_total.%s%s",
|
||||
here->BSIM3name,
|
||||
BSIM3nNames[i]);
|
||||
data->namelist = (IFuid *) trealloc(
|
||||
(char *) data->namelist,
|
||||
(data->numPlots + 1)
|
||||
* sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist)
|
||||
return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid)) (ckt,
|
||||
|
|
@ -187,10 +181,7 @@ int i;
|
|||
(void) sprintf(name, "inoise_total.%s%s",
|
||||
here->BSIM3name,
|
||||
BSIM3nNames[i]);
|
||||
data->namelist = (IFuid *) trealloc(
|
||||
(char *) data->namelist,
|
||||
(data->numPlots + 1)
|
||||
* sizeof(IFuid));
|
||||
data->namelist = TREALLOC(IFuid, data->namelist, data->numPlots + 1);
|
||||
if (!data->namelist)
|
||||
return(E_NOMEM);
|
||||
(*(SPfrontEnd->IFnewUid)) (ckt,
|
||||
|
|
|
|||
|
|
@ -1033,7 +1033,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
|
|||
InstCount++;
|
||||
}
|
||||
}
|
||||
InstArray = (BSIM3instance**)tmalloc(InstCount*sizeof(BSIM3instance*));
|
||||
InstArray = TMALLOC(BSIM3instance*, InstCount);
|
||||
model = (BSIM3model*)inModel;
|
||||
idx = 0;
|
||||
for( ; model != NULL; model = model->BSIM3nextModel )
|
||||
|
|
|
|||
|
|
@ -163,8 +163,7 @@ int Size_Not_Found;
|
|||
}
|
||||
|
||||
if (Size_Not_Found)
|
||||
{ pParam = (struct bsim3SizeDependParam *)tmalloc(
|
||||
sizeof(struct bsim3SizeDependParam));
|
||||
{ pParam = TMALLOC(struct bsim3SizeDependParam, 1);
|
||||
if (pLastKnot == NULL)
|
||||
model->pSizeDependParamKnot = pParam;
|
||||
else
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue