Browse Source

struct variable, #1/18, cleanup for loops

pre-master-46
rlar 10 years ago
parent
commit
cb4c07b7f0
  1. 2
      src/frontend/options.c
  2. 8
      src/frontend/spiceif.c

2
src/frontend/options.c

@ -65,7 +65,7 @@ cp_enqvar(char *word)
vv->va_name = copy(word);
vv->va_type = CP_LIST;
vv->va_vlist = NULL;
for (i = d->v_length - 1; i >= 0; i--) {
for (i = d->v_length; --i >= 0;) {
tv = TMALLOC(struct variable, 1);
tv->va_name = NULL;
tv->va_type = CP_REAL;

8
src/frontend/spiceif.c

@ -983,17 +983,13 @@ parmtovar(IFvalue *pv, IFparm *opt)
case IF_REALVEC:
vv->va_type = CP_LIST;
vv->va_vlist = NULL;
for (i = 0; i < pv->v.numValue; i++) {
for (i = pv->v.numValue; --i >= 0;) {
nv = TMALLOC(struct variable, 1);
nv->va_name = NULL;
nv->va_next = vv->va_vlist;
vv->va_vlist = nv;
nv->va_type = CP_REAL;
/* Change this so that the values are printed in order and
* not in inverted order as happens in the conversion process.
* Originally was nv->va_real = pv->v.vec.rVec[i];
*/
nv->va_real = pv->v.vec.rVec[pv->v.numValue-i-1];
nv->va_real = pv->v.vec.rVec[i];
}
/* It is a linked list where the first node is a variable
* pointing to the different values of the variables.

Loading…
Cancel
Save