From dcef3da6779fb497c307e3490c69af445c4bd594 Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 28 Dec 2015 12:48:15 +0100 Subject: [PATCH] frontend/device.c, com_alter_common(), #3/4 use `wl_cons()' --- src/frontend/device.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/frontend/device.c b/src/frontend/device.c index 0aafbed47..ae1ed865b 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -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