From c3df8cdad19da5b51bfdade1e897fa6348cbc900 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Wed, 26 Dec 2007 11:23:56 +0100 Subject: [PATCH] Reverse direction of filter list Insert items into the filter list at the tail rather than at the head, this makes it easier for users to understand what's going on. --- lib/myopt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/myopt.c b/lib/myopt.c index 64d4122c..5373defe 100644 --- a/lib/myopt.c +++ b/lib/myopt.c @@ -175,6 +175,7 @@ struct filterlist *filters = NULL; void loadfilter(char *fn) { FILE* file; char linebuf[1024]; + struct filterlist *filtertail; file = fopen(fn, "r"); if (!file) { @@ -212,8 +213,15 @@ void loadfilter(char *fn) { ohshite(_("Error allocating memory for filter entry")); } strcpy(filter->filterstring, &linebuf[1]); - filter->next = filters; - filters = filter; + + if (! filters) { + filters = filter; + filtertail = filter; + filter->next = NULL; + } else { + filtertail->next = filter; + filtertail = filtertail->next; + } } if (ferror(file)) ohshite(_("read error in configuration file `%.255s'"), fn); -- 2.39.5