Browse Source

implement wl_chop()

rlar 14 years ago
parent
commit
561d30e5bf
  1. 5
      src/frontend/subckt.c
  2. 1
      src/include/ngspice/wordlist.h
  3. 17
      src/misc/wlist.c

5
src/frontend/subckt.c

@ -674,10 +674,7 @@ doit(struct line *deck, wordlist *modnames) {
#endif
if(modnames != xmodnames) {
if(xmodnames && xmodnames->wl_prev) {
xmodnames->wl_prev->wl_next = NULL;
xmodnames->wl_prev = NULL;
}
wl_chop(xmodnames);
wl_free(modnames);
}

1
src/include/ngspice/wordlist.h

@ -28,6 +28,7 @@ wordlist * wl_range(wordlist *wl, int low, int up);
wordlist *wl_cons(char *word, wordlist *tail);
void wl_append_word(wordlist **first, wordlist **last, char *word);
wordlist *wl_chop(wordlist *wlist);
wordlist *wl_chop_rest(wordlist *wlist);

17
src/misc/wlist.c

@ -321,6 +321,23 @@ wl_append_word(wordlist **first, wordlist **last, char *word)
}
/*
* given a pointer `wl' into a wordlist
* cut off this list from its preceding elements
* and return itself
*/
wordlist *
wl_chop(wordlist *wl)
{
if (wl && wl->wl_prev) {
wl->wl_prev->wl_next = NULL;
wl->wl_prev = NULL;
}
return wl;
}
/*
* given a pointer `wl' into a wordlist
* cut off the rest of the list

Loading…
Cancel
Save