frontend/vectors.c, vec_get(), #2/2 rewrite

This commit is contained in:
rlar 2015-12-22 17:31:44 +01:00
parent d360023e14
commit 30becb4509
1 changed files with 11 additions and 11 deletions

View File

@ -574,18 +574,18 @@ vec_get(const char *vec_name)
* used with the parameters of isrc and vsrc
*/
struct variable *nv;
double *list;
list = TMALLOC(double, 1);
nv = vv->va_vlist;
for (i = 1; ; i++) {
list = TREALLOC(double, list, i);
list[i-1] = nv->va_real;
nv = nv->va_next;
if (!nv)
break;
}
d->v_realdata = list;
i = 0;
for (nv = vv->va_vlist; nv; nv = nv->va_next)
i++;
d->v_realdata = TREALLOC(double, d->v_realdata, i);
d->v_length = i;
i = 0;
for (nv = vv->va_vlist; nv; nv = nv->va_next)
d->v_realdata[i++] = nv->va_real;
/* To be able to identify the vector to represent
* belongs to a special "conunto" and should be printed in a
* special way.