From 908c650f728aaf8908357dbd5a70dfdb65415af7 Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 28 Dec 2015 20:24:54 +0100 Subject: [PATCH] dvec abstraction, #3/11, use `dvec_alloc()' --- src/frontend/com_compose.c | 2 +- src/frontend/com_fft.c | 8 ++++---- src/frontend/com_let.c | 2 +- src/frontend/define.c | 2 +- src/frontend/device.c | 2 +- src/frontend/evaluate.c | 8 ++++---- src/frontend/fourier.c | 2 +- src/frontend/interp.c | 2 +- src/frontend/linear.c | 2 +- src/frontend/outitf.c | 2 +- src/frontend/parse.c | 4 ++-- src/frontend/plotting/plotit.c | 2 +- src/frontend/postcoms.c | 2 +- src/frontend/rawfile.c | 2 +- src/frontend/spec.c | 6 +++--- src/frontend/vectors.c | 6 +++--- src/maths/cmaths/cmath4.c | 4 ++-- src/ngsconvert.c | 2 +- src/xspice/evt/evtplot.c | 4 ++-- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/frontend/com_compose.c b/src/frontend/com_compose.c index 76ac512cc..2f1c763e9 100644 --- a/src/frontend/com_compose.c +++ b/src/frontend/com_compose.c @@ -451,7 +451,7 @@ com_compose(wordlist *wl) } } - result = alloc(struct dvec); + result = dvec_alloc(); ZERO(result, struct dvec); result->v_name = resname; result->v_type = type; diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index 5a2b32ed8..ae2a1663e 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -128,7 +128,7 @@ com_fft(wordlist *wl) plot_cur->pl_name = copy("Spectrum"); plot_cur->pl_date = copy(datestring()); - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = copy("frequency"); f->v_type = SV_FREQUENCY; @@ -149,7 +149,7 @@ com_fft(wordlist *wl) fdvec = TMALLOC(ngcomplex_t *, ngood); for (i = 0, vec = vlist; iv_realdata; /* real input data */ - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = vec_basename(vec); f->v_type = SV_NOTYPE; @@ -354,7 +354,7 @@ com_psd(wordlist *wl) plot_cur->pl_name = copy("PSD"); plot_cur->pl_date = copy(datestring()); - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = copy("frequency"); f->v_type = SV_FREQUENCY; @@ -376,7 +376,7 @@ com_psd(wordlist *wl) fdvec = TMALLOC(ngcomplex_t*, ngood); for (i = 0, vec = vlist; iv_realdata; /* real input data */ - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = vec_basename(vec); f->v_type = SV_NOTYPE; //vec->v_type; diff --git a/src/frontend/com_let.c b/src/frontend/com_let.c index fec97be30..2c0336e71 100644 --- a/src/frontend/com_let.c +++ b/src/frontend/com_let.c @@ -161,7 +161,7 @@ com_let(wordlist *wl) } /* create and assign a new vector */ - n = alloc(struct dvec); + n = dvec_alloc(); ZERO(n, struct dvec); n->v_name = copy(p); n->v_type = t->v_type; diff --git a/src/frontend/define.c b/src/frontend/define.c index fb0a6b7c2..a41de2748 100644 --- a/src/frontend/define.c +++ b/src/frontend/define.c @@ -161,7 +161,7 @@ savetree(struct pnode *pn) */ d = pn->pn_value; if ((d->v_length != 0) || eq(d->v_name, "list")) { - pn->pn_value = alloc(struct dvec); + pn->pn_value = dvec_alloc(); ZERO(pn->pn_value, struct dvec); pn->pn_value->v_name = copy(d->v_name); pn->pn_value->v_length = d->v_length; diff --git a/src/frontend/device.c b/src/frontend/device.c index f9b34effb..6fb832b30 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -1317,7 +1317,7 @@ com_alter_common(wordlist *wl, int do_model) return; } - dv = TMALLOC(struct dvec, 1); + dv = dvec_alloc(); if (!dv) return; diff --git a/src/frontend/evaluate.c b/src/frontend/evaluate.c index a044e5c5a..a6a9adfbc 100644 --- a/src/frontend/evaluate.c +++ b/src/frontend/evaluate.c @@ -318,7 +318,7 @@ doop(char what, if (!data) return (NULL); /* Make up the new vector. */ - res = alloc(struct dvec); + res = dvec_alloc(); ZERO(res, struct dvec); if (relflag || (isreal(v1) && isreal(v2) && (func != cx_comma))) { res->v_type = SV_NOTYPE; @@ -615,7 +615,7 @@ op_range(struct pnode *arg1, struct pnode *arg2) len++; } - res = alloc(struct dvec); + res = dvec_alloc(); ZERO(res, struct dvec); res->v_name = mkcname('R', v->v_name, ind->v_name); res->v_type = v->v_type; @@ -771,7 +771,7 @@ op_ind(struct pnode *arg1, struct pnode *arg2) length = blocksize * (up - down + 1); /* Make up the new vector. */ - res = alloc(struct dvec); + res = dvec_alloc(); ZERO(res, struct dvec); res->v_name = mkcname('[', v->v_name, ind->v_name); res->v_type = v->v_type; @@ -941,7 +941,7 @@ apply_func(struct func *func, struct pnode *arg) else name = mkcname('b', v->v_name, NULL); - t = alloc(struct dvec); + t = dvec_alloc(); ZERO(t, struct dvec); t->v_name = name; diff --git a/src/frontend/fourier.c b/src/frontend/fourier.c index b2f40dca7..2d69a11ed 100644 --- a/src/frontend/fourier.c +++ b/src/frontend/fourier.c @@ -192,7 +192,7 @@ fourier(wordlist *wl, struct plot *current_plot) /* create and assign a new vector n */ /* with size 3 * nfreqs in current plot */ /* generate name for new vector, using vec->name */ - n = alloc(struct dvec); + n = dvec_alloc(); ZERO(n, struct dvec); n->v_name = tprintf("fourier%d%d", callstof, newveccount); diff --git a/src/frontend/interp.c b/src/frontend/interp.c index 28e5d4d4d..1938f6649 100644 --- a/src/frontend/interp.c +++ b/src/frontend/interp.c @@ -30,7 +30,7 @@ lincopy(struct dvec *ov, double *newscale, int newlen, struct dvec *oldscale) return; } - v = alloc(struct dvec); + v = dvec_alloc(); v->v_name = copy(ov->v_name); v->v_type = ov->v_type; v->v_flags = ov->v_flags; diff --git a/src/frontend/linear.c b/src/frontend/linear.c index 6052dedaf..7e32d73b9 100644 --- a/src/frontend/linear.c +++ b/src/frontend/linear.c @@ -62,7 +62,7 @@ com_linearize(wordlist *wl) plot_setcur(new->pl_typename); plot_list = new; len = (int)((tstop - tstart) / tstep + 1.5); - newtime = alloc(struct dvec); + newtime = dvec_alloc(); newtime->v_name = copy(oldtime->v_name); newtime->v_type = oldtime->v_type; newtime->v_flags = oldtime->v_flags; diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index f6f6dcdf9..6713802ca 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -1031,7 +1031,7 @@ plotInit(runDesc *run) else name = copy(dd->name); - v = alloc(struct dvec); + v = dvec_alloc(); v->v_name = name; v->v_type = guess_type(name); diff --git a/src/frontend/parse.c b/src/frontend/parse.c index bce2cd5b0..5dd7e7579 100644 --- a/src/frontend/parse.c +++ b/src/frontend/parse.c @@ -330,7 +330,7 @@ PP_mknnode(double number) struct pnode *p; struct dvec *v; - v = alloc(struct dvec); + v = dvec_alloc(); ZERO(v, struct dvec); /* We don't use printnum because it screws up PP_mkfnode above. We have @@ -368,7 +368,7 @@ PP_mksnode(const char *string) p = alloc_pnode(); v = vec_get(string); if (v == NULL) { - nv = alloc(struct dvec); + nv = dvec_alloc(); ZERO(nv, struct dvec); nv->v_name = copy(string); p->pn_value = nv; diff --git a/src/frontend/plotting/plotit.c b/src/frontend/plotting/plotit.c index 6b8612ecf..1d0bc9960 100644 --- a/src/frontend/plotting/plotit.c +++ b/src/frontend/plotting/plotit.c @@ -916,7 +916,7 @@ plotit(wordlist *wl, char *hcopy, char *devname) double *newscale; - struct dvec *newv_scale = alloc(struct dvec); + struct dvec *newv_scale = dvec_alloc(); struct dvec *v; newv_scale->v_name = copy(vecs->v_scale->v_name); diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index a924b23dd..dae91b37d 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -764,7 +764,7 @@ com_cross(wordlist *wl) } vec_remove(newvec); - v = alloc(struct dvec); + v = dvec_alloc(); v->v_name = copy(newvec); v->v_type = vecs ? vecs->v_type : SV_NOTYPE; v->v_length = i; diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index 38f67d170..51073aa79 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -468,7 +468,7 @@ raw_read(char *name) { * the desired vector length, but this would * be dangerous if the file is invalid. */ - v = alloc(struct dvec); + v = dvec_alloc(); ZERO(v, struct dvec); v->v_type = SV_NOTYPE; v->v_flags = (short)flags; diff --git a/src/frontend/spec.c b/src/frontend/spec.c index ccc2667a6..6cefc8a82 100644 --- a/src/frontend/spec.c +++ b/src/frontend/spec.c @@ -207,7 +207,7 @@ com_spec(wordlist *wl) plot_cur->pl_name = copy("Spectrum"); plot_cur->pl_date = copy(datestring()); - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = copy("frequency"); f->v_type = SV_FREQUENCY; @@ -221,7 +221,7 @@ com_spec(wordlist *wl) fdvec = TMALLOC(ngcomplex_t *, ngood); for (i = 0, vec = vlist; i < ngood; i++) { tdvec[i] = vec->v_realdata; - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = vec_basename(vec); f->v_type = vec->v_type; @@ -281,7 +281,7 @@ com_spec(wordlist *wl) fprintf(cp_err, " \r"); #ifdef KEEPWINDOW - f = alloc(struct dvec); + f = dvec_alloc(); ZERO(f, struct dvec); f->v_name = copy("win"); f->v_type = SV_NOTYPE; diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index c0e05220d..3174912c0 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -522,7 +522,7 @@ vec_get(const char *vec_name) return (NULL); } - d = alloc(struct dvec); + d = dvec_alloc(); ZERO(d, struct dvec); d->v_name = copy(whole); /* MW. The same as word before */ d->v_type = SV_NOTYPE; @@ -685,7 +685,7 @@ vec_copy(struct dvec *v) if (!v) return (NULL); - nv = alloc(struct dvec); + nv = dvec_alloc(); nv->v_name = copy(v->v_name); nv->v_type = v->v_type; nv->v_flags = v->v_flags & ~VF_PERMANENT; @@ -1122,7 +1122,7 @@ vec_mkfamily(struct dvec *v) indexstring(count, v->v_numdims - 1, buf2); - d = alloc(struct dvec); + d = dvec_alloc(); ZERO(d, struct dvec); d->v_name = tprintf("%s%s", v->v_name, buf2); diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 1ffccdb07..e42f0a870 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -626,7 +626,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp goto done; /* create a new scale vector */ - sv = alloc(struct dvec); + sv = dvec_alloc(); ZERO(sv, struct dvec); sv->v_name = copy("fft_scale"); sv->v_type = SV_FREQUENCY; @@ -863,7 +863,7 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty span = xscale[tpts-1] - xscale[0]; /* create a new scale vector */ - sv = alloc(struct dvec); + sv = dvec_alloc(); ZERO(sv, struct dvec); sv->v_name = copy("ifft_scale"); sv->v_type = SV_TIME; diff --git a/src/ngsconvert.c b/src/ngsconvert.c index 3e6a50c9b..eac43fc92 100644 --- a/src/ngsconvert.c +++ b/src/ngsconvert.c @@ -114,7 +114,7 @@ oldread(char *name) fprintf(cp_err, "Warning: magic number 4 is wrong...\n"); for (i = 0; i < nv; i++) { - v = alloc(struct dvec); + v = dvec_alloc(); if (end) end->v_next = v; else diff --git a/src/xspice/evt/evtplot.c b/src/xspice/evt/evtplot.c index c9d244008..20e93545d 100644 --- a/src/xspice/evt/evtplot.c +++ b/src/xspice/evt/evtplot.c @@ -187,7 +187,7 @@ struct dvec *EVTfindvec( /* Allocate dvec structures and assign the vectors into them. */ /* See FTE/OUTinterface.c:plotInit() for initialization example. */ - scale = TMALLOC(struct dvec, 1); + scale = dvec_alloc(); scale->v_name = MIFcopy("step"); scale->v_type = SV_TIME; @@ -196,7 +196,7 @@ struct dvec *EVTfindvec( scale->v_realdata = anal_point_vec; scale->v_scale = NULL; - d = TMALLOC(struct dvec, 1); + d = dvec_alloc(); d->v_name = name; d->v_type = SV_VOLTAGE;