Browse Source

fix struct variable initialisation

pre-master-46
rlar 10 years ago
parent
commit
1d15f6bfce
  1. 2
      src/frontend/options.c
  2. 2
      src/frontend/spiceif.c
  3. 3
      src/frontend/variable.c

2
src/frontend/options.c

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

2
src/frontend/spiceif.c

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

3
src/frontend/variable.c

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

Loading…
Cancel
Save