From 97cdaae19f97179499d2b22f70d730ce0785d77b Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 3 Aug 2016 20:23:58 +0200 Subject: [PATCH] variables, cp_usrvars(), be more explicit lift uv2 return value up to the invoker of cp_usrvars() --- src/frontend/options.c | 7 +++---- src/frontend/variable.c | 9 ++++++--- src/include/ngspice/cpextern.h | 2 +- src/ngsconvert.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/frontend/options.c b/src/frontend/options.c index 5aa3d9ecf..9ff73b61a 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -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; } diff --git a/src/frontend/variable.c b/src/frontend/variable.c index dd9423dfd..3c5e23fd7 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -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++; diff --git a/src/include/ngspice/cpextern.h b/src/include/ngspice/cpextern.h index 09bd378c2..7e2ab2542 100644 --- a/src/include/ngspice/cpextern.h +++ b/src/include/ngspice/cpextern.h @@ -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); diff --git a/src/ngsconvert.c b/src/ngsconvert.c index 0a1055d44..54c81db34 100644 --- a/src/ngsconvert.c +++ b/src/ngsconvert.c @@ -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"); }