struct variable, #4/18, shrink scope of local variables
This commit is contained in:
parent
830b4f443f
commit
b748f2d6d0
|
|
@ -38,9 +38,7 @@ struct variable *
|
|||
cp_enqvar(char *word)
|
||||
{
|
||||
struct dvec *d;
|
||||
struct variable *vv, *tv;
|
||||
struct plot *pl;
|
||||
int i;
|
||||
struct variable *vv;
|
||||
|
||||
if (*word == '&') {
|
||||
|
||||
|
|
@ -60,6 +58,7 @@ cp_enqvar(char *word)
|
|||
vv->va_type = CP_REAL;
|
||||
vv->va_real = value;
|
||||
} else {
|
||||
int i;
|
||||
vv = TMALLOC(struct variable, 1);
|
||||
vv->va_name = copy(word);
|
||||
vv->va_next = NULL;
|
||||
|
|
@ -69,6 +68,7 @@ cp_enqvar(char *word)
|
|||
double value = isreal(d)
|
||||
? d->v_realdata[i]
|
||||
: realpart(d->v_compdata[i]);
|
||||
struct variable *tv;
|
||||
tv = TMALLOC(struct variable, 1);
|
||||
tv->va_name = NULL;
|
||||
tv->va_next = vv->va_vlist;
|
||||
|
|
@ -114,12 +114,14 @@ cp_enqvar(char *word)
|
|||
vv->va_type = CP_STRING;
|
||||
vv->va_string = copy(plot_cur->pl_typename);
|
||||
} else if (eq(word, "plots")) {
|
||||
struct plot *pl;
|
||||
vv = TMALLOC(struct variable, 1);
|
||||
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) {
|
||||
struct variable *tv;
|
||||
tv = TMALLOC(struct variable, 1);
|
||||
tv->va_name = NULL;
|
||||
tv->va_next = vv->va_vlist;
|
||||
|
|
|
|||
|
|
@ -959,8 +959,6 @@ static struct variable *
|
|||
parmtovar(IFvalue *pv, IFparm *opt)
|
||||
{
|
||||
struct variable *vv = TMALLOC(struct variable, 1);
|
||||
struct variable *nv;
|
||||
int i = 0;
|
||||
|
||||
switch (opt->dataType & IF_VARTYPES) {
|
||||
case IF_INTEGER:
|
||||
|
|
@ -980,10 +978,12 @@ parmtovar(IFvalue *pv, IFparm *opt)
|
|||
vv->va_type = CP_BOOL;
|
||||
vv->va_bool = pv->iValue ? TRUE : FALSE;
|
||||
break;
|
||||
case IF_REALVEC:
|
||||
case IF_REALVEC: {
|
||||
int i;
|
||||
vv->va_type = CP_LIST;
|
||||
vv->va_vlist = NULL;
|
||||
for (i = pv->v.numValue; --i >= 0;) {
|
||||
struct variable *nv;
|
||||
nv = TMALLOC(struct variable, 1);
|
||||
nv->va_name = NULL;
|
||||
nv->va_next = vv->va_vlist;
|
||||
|
|
@ -1008,6 +1008,7 @@ parmtovar(IFvalue *pv, IFparm *opt)
|
|||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(cp_err,
|
||||
"parmtovar: Internal Error: bad PARM type %d.\n",
|
||||
|
|
|
|||
Loading…
Reference in New Issue