struct variable, #18/18, clean

This commit is contained in:
rlar 2016-03-25 15:41:27 +01:00
parent a6cd5eea45
commit ac726f0cf4
3 changed files with 4 additions and 7 deletions

View File

@ -85,9 +85,8 @@ cp_enqvar(char *word)
if (eq(word, "plots")) {
struct variable *list = NULL;
struct plot *pl;
for (pl = plot_list; pl; pl = pl->pl_next) {
for (pl = plot_list; pl; pl = pl->pl_next)
list = var_alloc_string(NULL, copy(pl->pl_typename), list);
}
return var_alloc_vlist(copy(word), list, NULL);
}
}

View File

@ -974,9 +974,8 @@ parmtovar(IFvalue *pv, IFparm *opt)
case IF_REALVEC: {
struct variable *list = NULL;
int i;
for (i = pv->v.numValue; --i >= 0;) {
for (i = pv->v.numValue; --i >= 0;)
list = var_alloc_real(NULL, pv->v.vec.rVec[i], list);
}
return var_alloc_vlist(copy(opt->description), list, NULL);
/* It is a linked list where the first node is a variable
* pointing to the different values of the variables.

View File

@ -339,11 +339,10 @@ cp_setparse(wordlist *wl)
}
copyval = ss = cp_unquote(wl->wl_word);
td = ft_numparse(&ss, FALSE);
if (td) {
if (td)
vv = var_alloc_real(NULL, *td, NULL);
} else {
else
vv = var_alloc_string(NULL, copy(ss), NULL);
}
tfree(copyval); /*DG: must free ss any way to avoid cp_unquote memory leak*/
if (listv) {
lv->va_next = vv;