dvec abstraction, #4/11, emphasise `ZERO(dvec)' initialisation
This commit is contained in:
parent
908c650f72
commit
8a4a37b5bb
|
|
@ -452,7 +452,6 @@ com_compose(wordlist *wl)
|
|||
}
|
||||
|
||||
result = dvec_alloc();
|
||||
ZERO(result, struct dvec);
|
||||
result->v_name = resname;
|
||||
result->v_type = type;
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ com_fft(wordlist *wl)
|
|||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
f->v_flags = (VF_REAL | VF_PERMANENT | VF_PRINT);
|
||||
|
|
@ -150,7 +149,6 @@ com_fft(wordlist *wl)
|
|||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata; /* real input data */
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = SV_NOTYPE;
|
||||
f->v_flags = (VF_COMPLEX | VF_PERMANENT);
|
||||
|
|
@ -355,7 +353,6 @@ com_psd(wordlist *wl)
|
|||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
f->v_flags = (VF_REAL | VF_PERMANENT | VF_PRINT);
|
||||
|
|
@ -377,7 +374,6 @@ com_psd(wordlist *wl)
|
|||
for (i = 0, vec = vlist; i<ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata; /* real input data */
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = SV_NOTYPE; //vec->v_type;
|
||||
f->v_flags = (VF_COMPLEX | VF_PERMANENT);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ com_let(wordlist *wl)
|
|||
|
||||
/* create and assign a new vector */
|
||||
n = dvec_alloc();
|
||||
ZERO(n, struct dvec);
|
||||
n->v_name = copy(p);
|
||||
n->v_type = t->v_type;
|
||||
n->v_flags = (t->v_flags | VF_PERMANENT);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ savetree(struct pnode *pn)
|
|||
d = pn->pn_value;
|
||||
if ((d->v_length != 0) || eq(d->v_name, "list")) {
|
||||
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;
|
||||
pn->pn_value->v_type = d->v_type;
|
||||
|
|
|
|||
|
|
@ -7,5 +7,10 @@ dvec_alloc(void)
|
|||
{
|
||||
struct dvec *rv = TMALLOC(struct dvec, 1);
|
||||
|
||||
if (!rv)
|
||||
return NULL;
|
||||
|
||||
ZERO(rv, struct dvec);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,7 +319,6 @@ doop(char what,
|
|||
return (NULL);
|
||||
/* Make up the new vector. */
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
if (relflag || (isreal(v1) && isreal(v2) && (func != cx_comma))) {
|
||||
res->v_type = SV_NOTYPE;
|
||||
res->v_flags = (v1->v_flags | v2->v_flags |
|
||||
|
|
@ -616,7 +615,6 @@ op_range(struct pnode *arg1, struct pnode *arg2)
|
|||
}
|
||||
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
res->v_name = mkcname('R', v->v_name, ind->v_name);
|
||||
res->v_type = v->v_type;
|
||||
res->v_flags = v->v_flags;
|
||||
|
|
@ -772,7 +770,6 @@ op_ind(struct pnode *arg1, struct pnode *arg2)
|
|||
|
||||
/* Make up the new vector. */
|
||||
res = dvec_alloc();
|
||||
ZERO(res, struct dvec);
|
||||
res->v_name = mkcname('[', v->v_name, ind->v_name);
|
||||
res->v_type = v->v_type;
|
||||
res->v_flags = v->v_flags;
|
||||
|
|
@ -942,7 +939,6 @@ apply_func(struct func *func, struct pnode *arg)
|
|||
name = mkcname('b', v->v_name, NULL);
|
||||
|
||||
t = dvec_alloc();
|
||||
ZERO(t, struct dvec);
|
||||
t->v_name = name;
|
||||
|
||||
t->v_flags = (v->v_flags & ~VF_COMPLEX & ~VF_REAL &
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ fourier(wordlist *wl, struct plot *current_plot)
|
|||
/* with size 3 * nfreqs in current plot */
|
||||
/* generate name for new vector, using vec->name */
|
||||
n = dvec_alloc();
|
||||
ZERO(n, struct dvec);
|
||||
|
||||
n->v_name = tprintf("fourier%d%d", callstof, newveccount);
|
||||
n->v_type = SV_NOTYPE;
|
||||
|
|
|
|||
|
|
@ -331,7 +331,6 @@ PP_mknnode(double number)
|
|||
struct dvec *v;
|
||||
|
||||
v = dvec_alloc();
|
||||
ZERO(v, struct dvec);
|
||||
|
||||
/* We don't use printnum because it screws up PP_mkfnode above. We have
|
||||
* to be careful to deal properly with node numbers that are quite
|
||||
|
|
@ -369,7 +368,6 @@ PP_mksnode(const char *string)
|
|||
v = vec_get(string);
|
||||
if (v == NULL) {
|
||||
nv = dvec_alloc();
|
||||
ZERO(nv, struct dvec);
|
||||
nv->v_name = copy(string);
|
||||
p->pn_value = nv;
|
||||
return (p);
|
||||
|
|
|
|||
|
|
@ -469,7 +469,6 @@ raw_read(char *name) {
|
|||
* be dangerous if the file is invalid.
|
||||
*/
|
||||
v = dvec_alloc();
|
||||
ZERO(v, struct dvec);
|
||||
v->v_type = SV_NOTYPE;
|
||||
v->v_flags = (short)flags;
|
||||
v->v_length = npoints;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,6 @@ com_spec(wordlist *wl)
|
|||
plot_cur->pl_date = copy(datestring());
|
||||
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("frequency");
|
||||
f->v_type = SV_FREQUENCY;
|
||||
f->v_flags = (VF_REAL | VF_PERMANENT | VF_PRINT);
|
||||
|
|
@ -222,7 +221,6 @@ com_spec(wordlist *wl)
|
|||
for (i = 0, vec = vlist; i < ngood; i++) {
|
||||
tdvec[i] = vec->v_realdata;
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = vec_basename(vec);
|
||||
f->v_type = vec->v_type;
|
||||
f->v_flags = (VF_COMPLEX | VF_PERMANENT);
|
||||
|
|
@ -282,7 +280,6 @@ com_spec(wordlist *wl)
|
|||
|
||||
#ifdef KEEPWINDOW
|
||||
f = dvec_alloc();
|
||||
ZERO(f, struct dvec);
|
||||
f->v_name = copy("win");
|
||||
f->v_type = SV_NOTYPE;
|
||||
f->v_flags = (VF_REAL | VF_PERMANENT);
|
||||
|
|
|
|||
|
|
@ -523,7 +523,6 @@ vec_get(const char *vec_name)
|
|||
}
|
||||
|
||||
d = dvec_alloc();
|
||||
ZERO(d, struct dvec);
|
||||
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... */
|
||||
|
|
@ -1123,7 +1122,6 @@ vec_mkfamily(struct dvec *v)
|
|||
indexstring(count, v->v_numdims - 1, buf2);
|
||||
|
||||
d = dvec_alloc();
|
||||
ZERO(d, struct dvec);
|
||||
|
||||
d->v_name = tprintf("%s%s", v->v_name, buf2);
|
||||
d->v_type = v->v_type;
|
||||
|
|
|
|||
|
|
@ -627,7 +627,6 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp
|
|||
|
||||
/* create a new scale vector */
|
||||
sv = dvec_alloc();
|
||||
ZERO(sv, struct dvec);
|
||||
sv->v_name = copy("fft_scale");
|
||||
sv->v_type = SV_FREQUENCY;
|
||||
sv->v_flags = (VF_REAL | VF_PERMANENT | VF_PRINT);
|
||||
|
|
@ -864,7 +863,6 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty
|
|||
|
||||
/* create a new scale vector */
|
||||
sv = dvec_alloc();
|
||||
ZERO(sv, struct dvec);
|
||||
sv->v_name = copy("ifft_scale");
|
||||
sv->v_type = SV_TIME;
|
||||
sv->v_flags = (VF_REAL | VF_PERMANENT | VF_PRINT);
|
||||
|
|
|
|||
Loading…
Reference in New Issue