From 650352e3e86ee8ac0775df1a36f8645fa6f47201 Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 16 Jul 2014 20:21:21 +0200 Subject: [PATCH] subckt.c, cleanup `doit()' --- src/frontend/subckt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index d2e14e0fa..c172d7712 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -458,11 +458,6 @@ doit(struct line *deck, wordlist *modnames) { /* c points to the opening .subckt card */ /* ends points to the terminating .ends card */ - /* cut the whole .subckt ... .ends sequence from the deck chain */ - if (prev_of_c) - prev_of_c->li_next = ends->li_next; - else - deck = ends->li_next; /* Now put the .subckt definition found into sss */ @@ -494,9 +489,16 @@ doit(struct line *deck, wordlist *modnames) { sss->su_next = subs; subs = sss; + /* cut the whole .subckt ... .ends sequence from the deck chain */ + line_free_x(c, FALSE); c = ends->li_next; + if (prev_of_c) + prev_of_c->li_next = ends->li_next; + else + deck = ends->li_next; + if (use_numparams == FALSE) { line_free_x(ends, FALSE); /* drop the .ends card */ prev_of_ends->li_next = NULL;