fix struct variable initialisation

This commit is contained in:
rlar 2016-03-25 14:52:14 +01:00
parent 698cbe20dd
commit 1d15f6bfce
3 changed files with 6 additions and 1 deletions

View File

@ -67,6 +67,7 @@ cp_enqvar(char *word)
vv->va_vlist = NULL;
for (i = d->v_length - 1; i >= 0; i--) {
tv = TMALLOC(struct variable, 1);
tv->va_name = NULL;
tv->va_type = CP_REAL;
if (isreal(d))
tv->va_real = d->v_realdata[i];
@ -120,6 +121,7 @@ cp_enqvar(char *word)
vv->va_vlist = NULL;
for (pl = plot_list; pl; pl = pl->pl_next) {
tv = TMALLOC(struct variable, 1);
tv->va_name = NULL;
tv->va_type = CP_STRING;
tv->va_string = copy(pl->pl_typename);
tv->va_next = vv->va_vlist;

View File

@ -982,8 +982,10 @@ parmtovar(IFvalue *pv, IFparm *opt)
break;
case IF_REALVEC:
vv->va_type = CP_LIST;
vv->va_vlist = NULL;
for (i = 0; i < pv->v.numValue; i++) {
nv = TMALLOC(struct variable, 1);
nv->va_name = NULL;
nv->va_next = vv->va_vlist;
vv->va_vlist = nv;
nv->va_type = CP_REAL;

View File

@ -347,6 +347,7 @@ cp_setparse(wordlist *wl)
break;
}
vv = TMALLOC(struct variable, 1);
vv->va_name = NULL;
vv->va_next = NULL;
copyval = ss = cp_unquote(wl->wl_word);
td = ft_numparse(&ss, FALSE);
@ -462,8 +463,8 @@ cp_remvar(char *varname)
if (!v) {
/* Gotta make up a var struct for cp_usrset()... */
v = TMALLOC(struct variable, 1);
ZERO(v, struct variable);
v->va_name = copy(varname);
v->va_next = NULL;
v->va_type = CP_NUM;
v->va_num = 0;
found = FALSE;