subckt.c, cleanup `doit()'
This commit is contained in:
parent
c105c320f8
commit
1e83c0772b
|
|
@ -466,8 +466,6 @@ doit(struct line *deck, wordlist *modnames) {
|
||||||
/* c is the terminating .ends card */
|
/* c is the terminating .ends card */
|
||||||
/* lcc is one card before, which is the last body card */
|
/* lcc is one card before, which is the last body card */
|
||||||
|
|
||||||
sss = alloc(struct subs);
|
|
||||||
|
|
||||||
if (use_numparams == FALSE)
|
if (use_numparams == FALSE)
|
||||||
lcc->li_next = NULL; /* shouldn't we free some memory here????? */
|
lcc->li_next = NULL; /* shouldn't we free some memory here????? */
|
||||||
|
|
||||||
|
|
@ -478,13 +476,18 @@ doit(struct line *deck, wordlist *modnames) {
|
||||||
deck = c->li_next;
|
deck = c->li_next;
|
||||||
|
|
||||||
/* Now put the .subckt definition found into sss */
|
/* Now put the .subckt definition found into sss */
|
||||||
sss->su_def = last->li_next;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
char *s = last->li_line;
|
char *s = last->li_line;
|
||||||
|
|
||||||
|
sss = alloc(struct subs);
|
||||||
|
|
||||||
txfree(gettok(&s));
|
txfree(gettok(&s));
|
||||||
|
|
||||||
sss->su_name = gettok(&s);
|
sss->su_name = gettok(&s);
|
||||||
sss->su_args = copy(s);
|
sss->su_args = copy(s);
|
||||||
|
sss->su_def = last->li_next;
|
||||||
|
|
||||||
/* count the number of args in the .subckt line */
|
/* count the number of args in the .subckt line */
|
||||||
sss->su_numargs = 0;
|
sss->su_numargs = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -675,22 +678,15 @@ doit(struct line *deck, wordlist *modnames) {
|
||||||
return NULL; /* error message already reported; should free() */
|
return NULL; /* error message already reported; should free() */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
struct subs {
|
|
||||||
char *su_name;
|
|
||||||
char *su_args;
|
|
||||||
int su_numargs;
|
|
||||||
struct line *su_def;
|
|
||||||
struct subs *su_next;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
while (subs) {
|
while (subs) {
|
||||||
struct subs *sss2 = subs;
|
struct subs *rest = subs->su_next;
|
||||||
subs = subs->su_next;
|
|
||||||
tfree(sss2->su_name);
|
tfree(subs->su_name);
|
||||||
tfree(sss2->su_args);
|
tfree(subs->su_args);
|
||||||
line_free(sss2->su_def, TRUE);
|
line_free(subs->su_def, TRUE);
|
||||||
tfree(sss2);
|
tfree(subs);
|
||||||
|
|
||||||
|
subs = rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (deck);
|
return (deck);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue