From 3baaa57d18649d23514bf701d5e6b7a21c030353 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 8 Jun 2017 09:16:01 +0200 Subject: [PATCH] device.c, #3/19, move some code up --- src/frontend/device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/frontend/device.c b/src/frontend/device.c index f5e31e631..a5b933356 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -1163,6 +1163,9 @@ com_alter_common(wordlist *wl, int do_model) if (strlen(argument) == 1) { step = -1; wl2 = wlin; + /* step back in the wordlist, if we have moved forward, to catch 'm1' */ + for (i = step; i > 0; i--) + wl2 = wl2->wl_prev; } else if (strlen(argument) > 1) { wl2 = NULL; if (eqptr[1]) @@ -1172,6 +1175,9 @@ com_alter_common(wordlist *wl, int do_model) wl2 = wl_cons(copy_substring(argument, eqptr), wl2); /* combine wordlists into wl2, free wl */ wl_splice(wl, wl2); + /* step back in the wordlist, if we have moved forward, to catch 'm1' */ + for (i = step; i > 0; i--) + wl2 = wl2->wl_prev; } break; } @@ -1184,9 +1190,6 @@ com_alter_common(wordlist *wl, int do_model) } if (eqfound) { - /* step back in the wordlist, if we have moved forward, to catch 'm1' */ - for (i = step; i > 0; i--) - wl2 = wl2->wl_prev; } else { /* no equal sign found, probably a pre3f4 input format 'alter device value'