From 8b7cc1a0ed95e8a3ff413fa77eb12a3dca7fccb4 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Fri, 7 Feb 2020 23:44:03 -0500 Subject: Clear completion for ID on self-part --- complete.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'complete.c') diff --git a/complete.c b/complete.c index 5067512..437bb7d 100644 --- a/complete.c +++ b/complete.c @@ -122,3 +122,15 @@ void completeRemove(size_t id, const char *str) { free(node); } } + +void completeClear(size_t id) { + struct Node *next = NULL; + for (struct Node *node = head; node; node = next) { + next = node->next; + if (node->id != id) continue; + if (match == node) match = NULL; + detach(node); + free(node->str); + free(node); + } +} -- cgit 1.4.1-2-gfad0