Add a fcn wl_delete to free the wordlist, but not its wl_word contents.
This commit is contained in:
parent
97d9f38421
commit
fc7ba6ee8f
|
|
@ -23,6 +23,7 @@ void wl_delete_slice(wordlist *from, wordlist *to);
|
||||||
wordlist *wl_find(const char *string, const wordlist *wlist);
|
wordlist *wl_find(const char *string, const wordlist *wlist);
|
||||||
char * wl_flatten(const wordlist *wl);
|
char * wl_flatten(const wordlist *wl);
|
||||||
void wl_free(wordlist *wlist);
|
void wl_free(wordlist *wlist);
|
||||||
|
void wl_delete(wordlist *wlist);
|
||||||
wordlist *wl_from_string(const char *sz);
|
wordlist *wl_from_string(const char *sz);
|
||||||
int wl_length(const wordlist *wlist);
|
int wl_length(const wordlist *wlist);
|
||||||
char ** wl_mkvec(const wordlist *wl);
|
char ** wl_mkvec(const wordlist *wl);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,18 @@ wl_free(wordlist *wl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Free the storage used by the word list only,
|
||||||
|
but not the wl->wl_word. */
|
||||||
|
void
|
||||||
|
wl_delete(wordlist* wl)
|
||||||
|
{
|
||||||
|
while (wl) {
|
||||||
|
wordlist* next = wl->wl_next;
|
||||||
|
tfree(wl);
|
||||||
|
wl = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Copy a wordlist and the words. */
|
/* Copy a wordlist and the words. */
|
||||||
wordlist *
|
wordlist *
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue