Browse Source

plotting/plotit.c, xtend(), #4/7 support vector of zero length

pre-master-46
rlar 10 years ago
parent
commit
64b43b0c68
  1. 8
      src/frontend/plotting/plotit.c

8
src/frontend/plotting/plotit.c

@ -97,21 +97,25 @@ xtend(struct dvec *v, int length)
} }
if (isreal(v)) { if (isreal(v)) {
double d = NAN;
od = v->v_realdata; od = v->v_realdata;
v->v_realdata = TMALLOC(double, length); v->v_realdata = TMALLOC(double, length);
for (i = 0; i < v->v_length; i++) for (i = 0; i < v->v_length; i++)
v->v_realdata[i] = od[i]; v->v_realdata[i] = od[i];
d = od[i - 1];
if (i > 0)
d = od[i - 1];
tfree(od); tfree(od);
while (i < length) while (i < length)
v->v_realdata[i++] = d; v->v_realdata[i++] = d;
} else { } else {
ngcomplex_t c = {NAN, NAN};
oc = v->v_compdata; oc = v->v_compdata;
v->v_compdata = TMALLOC(ngcomplex_t, length); v->v_compdata = TMALLOC(ngcomplex_t, length);
for (i = 0; i < v->v_length; i++) { for (i = 0; i < v->v_length; i++) {
v->v_compdata[i] = oc[i]; v->v_compdata[i] = oc[i];
} }
c = oc[i - 1];
if (i > 0)
c = oc[i - 1];
tfree(oc); tfree(oc);
while (i < length) while (i < length)
v->v_compdata[i++] = c; v->v_compdata[i++] = c;

Loading…
Cancel
Save