From cb4c07b7f00d54e13057f9dea5f08cfb34c938ac Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 25 Mar 2016 15:35:04 +0100 Subject: [PATCH] struct variable, #1/18, cleanup for loops --- src/frontend/options.c | 2 +- src/frontend/spiceif.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/frontend/options.c b/src/frontend/options.c index f01757902..8e5984d2b 100644 --- a/src/frontend/options.c +++ b/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; diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 3b39be5a3..a8cf877d8 100644 --- a/src/frontend/spiceif.c +++ b/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.