struct variable, #2/18, reorder struct variable field initialisation

This commit is contained in:
rlar 2016-03-25 15:35:20 +01:00
parent cb4c07b7f0
commit 01a0449420
3 changed files with 12 additions and 12 deletions

View File

@ -52,8 +52,8 @@ cp_enqvar(char *word)
if (d->v_length == 1) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_REAL;
if (isreal(d))
vv->va_real = d->v_realdata[0];
@ -61,19 +61,19 @@ cp_enqvar(char *word)
vv->va_real = realpart(d->v_compdata[0]);
} else {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_LIST;
vv->va_vlist = NULL;
for (i = d->v_length; --i >= 0;) {
tv = TMALLOC(struct variable, 1);
tv->va_name = NULL;
tv->va_next = vv->va_vlist;
tv->va_type = CP_REAL;
if (isreal(d))
tv->va_real = d->v_realdata[i];
else
tv->va_real = realpart(d->v_compdata[i]);
tv->va_next = vv->va_vlist;
vv->va_vlist = tv;
}
}
@ -91,40 +91,40 @@ cp_enqvar(char *word)
return (vv);
if (eq(word, "curplotname")) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_STRING;
vv->va_string = copy(plot_cur->pl_name);
} else if (eq(word, "curplottitle")) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_STRING;
vv->va_string = copy(plot_cur->pl_title);
} else if (eq(word, "curplotdate")) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_STRING;
vv->va_string = copy(plot_cur->pl_date);
} else if (eq(word, "curplot")) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_STRING;
vv->va_string = copy(plot_cur->pl_typename);
} else if (eq(word, "plots")) {
vv = TMALLOC(struct variable, 1);
vv->va_next = NULL;
vv->va_name = copy(word);
vv->va_next = NULL;
vv->va_type = CP_LIST;
vv->va_vlist = NULL;
for (pl = plot_list; pl; pl = pl->pl_next) {
tv = TMALLOC(struct variable, 1);
tv->va_name = NULL;
tv->va_next = vv->va_vlist;
tv->va_type = CP_STRING;
tv->va_string = copy(pl->pl_typename);
tv->va_next = vv->va_vlist;
vv->va_vlist = tv;
}
}

View File

@ -987,9 +987,9 @@ parmtovar(IFvalue *pv, IFparm *opt)
nv = TMALLOC(struct variable, 1);
nv->va_name = NULL;
nv->va_next = vv->va_vlist;
vv->va_vlist = nv;
nv->va_type = CP_REAL;
nv->va_real = pv->v.vec.rVec[i];
vv->va_vlist = nv;
}
/* It is a linked list where the first node is a variable
* pointing to the different values of the variables.

View File

@ -284,9 +284,9 @@ cp_setparse(wordlist *wl)
if ((!wl || (*wl->wl_word != '=')) && !strchr(name, '=')) {
vv = TMALLOC(struct variable, 1);
vv->va_name = copy(name);
vv->va_next = vars;
vv->va_type = CP_BOOL;
vv->va_bool = TRUE;
vv->va_next = vars;
vars = vv;
tfree(name); /*DG: cp_unquote Memory leak*/
continue;
@ -377,9 +377,9 @@ cp_setparse(wordlist *wl)
vv = TMALLOC(struct variable, 1);
vv->va_name = copy(name);
vv->va_next = vars;
vv->va_type = CP_LIST;
vv->va_vlist = listv;
vv->va_next = vars;
vars = vv;
wl = wl->wl_next;