variables, cp_usrvars(), be more explicit

lift uv2 return value up to the invoker of cp_usrvars()
This commit is contained in:
rlar 2016-08-03 20:23:58 +02:00
parent 596599492e
commit 97cdaae19f
4 changed files with 11 additions and 9 deletions

View File

@ -102,8 +102,8 @@ cp_enqvar(char *word)
/* Return the plot and ckt env vars, $plots, and $curplot{name,title,date,} */
void
cp_usrvars(struct variable **v1, struct variable **v2)
struct variable *
cp_usrvars(void)
{
struct variable *v, *tv;
@ -130,8 +130,7 @@ cp_usrvars(struct variable **v1, struct variable **v2)
v = tv;
}
*v1 = v;
*v2 = ft_curckt ? ft_curckt->ci_vars : NULL;
return v;
}

View File

@ -404,7 +404,8 @@ cp_remvar(char *varname)
bool found = TRUE;
int i, var_index = 0;
cp_usrvars(&uv1, &uv2);
uv1 = cp_usrvars();
uv2 = ft_curckt ? ft_curckt->ci_vars : NULL;
for (v = variables; v; v = v->va_next) {
var_index = 0;
@ -526,7 +527,8 @@ cp_getvar(char *name, enum cp_types type, void *retval)
struct variable *v;
struct variable *uv1, *uv2;
cp_usrvars(&uv1, &uv2);
uv1 = cp_usrvars();
uv2 = ft_curckt ? ft_curckt->ci_vars : NULL;
#ifdef TRACE
/* SDB debug statement */
@ -907,7 +909,8 @@ cp_vprint(void)
char *s;
struct xxx *vars;
cp_usrvars(&uv1, &uv2);
uv1 = cp_usrvars();
uv2 = ft_curckt ? ft_curckt->ci_vars : NULL;
for (v = uv1, i = 0; v; v = v->va_next)
i++;

View File

@ -182,7 +182,7 @@ extern void ft_cpinit(void);
extern struct comm *cp_coms;
extern char *cp_program;
extern struct variable *cp_enqvar(char *word);
extern void cp_usrvars(struct variable **v1, struct variable **v2);
extern struct variable *cp_usrvars(void);
int cp_usrset(struct variable *var, bool isset);
extern void fatal(void);

View File

@ -429,7 +429,7 @@ void cp_pushcontrol(void) { }
void cp_popcontrol(void) { }
void out_init(void) { }
void cp_doquit(void) { exit(0); }
void cp_usrvars(struct variable **v1, struct variable **v2) { *v1 = NULL; *v2 = NULL; return; }
struct variable *cp_usrvars(void) { return NULL; }
int cp_evloop(char *s) { NG_IGNORE(s); return (0); }
void cp_ccon(bool o) { NG_IGNORE(o); }
char*if_errstring(int c) { NG_IGNORE(c); return copy("error"); }