From 61bd4079a0e2cb3817892580461407c8d009338d Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sat, 23 Jan 2021 16:15:39 -0500 Subject: Preserve order of filters when removing Filters should be kept in order since the first one that matches, wins. This lets highlights or ignores take priority over each other, if desired. --- filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter.c b/filter.c index 2a7d564..a648d8b 100644 --- a/filter.c +++ b/filter.c @@ -74,7 +74,7 @@ bool filterRemove(struct Filter filter) { if (filter.chan && strcasecmp(filters[i].chan, filter.chan)) continue; if (filter.mesg && strcasecmp(filters[i].mesg, filter.mesg)) continue; free(filters[i].mask); - filters[i] = filters[--len]; + memmove(&filters[i], &filters[i + 1], sizeof(*filters) * --len); filters[len] = (struct Filter) {0}; found = true; } -- cgit 1.4.1