frontend/device.c, com_alter_common(), #3/4 use `wl_cons()'

This commit is contained in:
rlar 2015-12-28 12:48:15 +01:00
parent 335a47f70a
commit dcef3da677
1 changed files with 4 additions and 16 deletions

View File

@ -1165,25 +1165,13 @@ com_alter_common(wordlist *wl, int do_model)
step = -1;
wl2 = wlin;
} else if (strlen(argument) > 1) {
char **arglist;
arglist = TMALLOC(char*, 4);
/* copy argument */
arglist[0] = copy_substring(argument, eqptr);
/* copy equal sign */
arglist[1] = copy("=");
/* copy expression */
arglist[2] = copy(eqptr + 1);
arglist[3] = NULL;
/* create a new wordlist from array arglist */
wl2 = wl_build(arglist);
wl2 = wl_cons(copy_substring(argument, eqptr),
wl_cons(copy("="),
wl_cons(copy(eqptr + 1),
NULL)));
/* combine wordlists into wl2, free wl */
wl_splice(wl, wl2);
wl = NULL;
/* free arglist */
for (n = 0; n < 3; n++)
tfree(arglist[n]);
tfree(arglist);
}
} else {
/* deal with 'altermod m1 vth0=0.7' by moving