implement wl_chop()
This commit is contained in:
parent
87c80b842c
commit
561d30e5bf
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue