From: Tollef Fog Heen Date: Wed, 26 Dec 2007 10:23:56 +0000 (+0100) Subject: Reverse direction of filter list X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3df8cdad19da5b51bfdade1e897fa6348cbc900;p=dpkg 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. --- 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);