--- ray/src/util/eplus_idf.c 2014/02/09 22:19:30 2.5 +++ ray/src/util/eplus_idf.c 2014/02/11 23:30:11 2.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: eplus_idf.c,v 2.5 2014/02/09 22:19:30 greg Exp $"; +static const char RCSid[] = "$Id: eplus_idf.c,v 2.7 2014/02/11 23:30:11 greg Exp $"; #endif /* * eplus_idf.c @@ -77,7 +77,7 @@ idf_addfield(IDF_PARAMETER *param, const char *fval, c if (fnew == NULL) return(0); fnew->next = NULL; - cp = fnew->arg; /* copy argument and comments */ + cp = fnew->val; /* copy value and comments */ while ((*cp++ = *fval++)) ; fnew->rem = cp; @@ -163,20 +163,18 @@ idf_movparam(IDF_LOADED *idf, IDF_PARAMETER *param, ID if ((idf == NULL) | (param == NULL)) return(0); + /* quick check if already there */ + if (param == (prev==NULL ? idf->pfirst : prev->dnext)) + return(1); /* find in IDF list, first*/ for (plast = NULL, pptr = idf->pfirst; pptr != param; plast = pptr, pptr = pptr->dnext) if (pptr == NULL) return(0); - if (plast == NULL) { - if (prev == NULL) - return(1); /* already in place */ + if (plast == NULL) idf->pfirst = param->dnext; - } else { - if (prev == plast) - return(1); /* already in place */ + else plast->dnext = param->dnext; - } if (idf->plast == param) idf->plast = plast; if (prev == NULL) { /* means they want it at beginning */ @@ -367,8 +365,8 @@ idf_writeparam(IDF_PARAMETER *param, FILE *fp, int inc fputs(param->rem, fp); for (fptr = param->flist; fptr != NULL; fptr = fptr->next) { if (!incl_comm) - fputs("\n\t", fp); - fputs(fptr->arg, fp); + fputs("\n ", fp); + fputs(fptr->val, fp); fputc((fptr->next==NULL ? ';' : ','), fp); if (incl_comm) fputs(fptr->rem, fp);