summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-12-21 18:02:16 -0300
committerAndrés <andmarti@gmail.com>2021-12-21 18:02:16 -0300
commit15bb86ee45d8cc78012571bb0021398c33c5b68c (patch)
tree9a926cc1b6d20a5a690e3b2d7fbaeedd0d41462b
parent3bda5392a3084b20d792c1e9f0a09f52a202f036 (diff)
work on issue #637
-rw-r--r--src/actions/filter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/actions/filter.c b/src/actions/filter.c
index 27403be..12362b8 100644
--- a/src/actions/filter.c
+++ b/src/actions/filter.c
@@ -57,7 +57,7 @@
#include "../sc.h"
#include "../cmds/cmds.h"
-static int howmany = 0; /**< how many filters were definedi */
+static int howmany = 0; /**< how many filters were defined */
static int active = 0; /**< indicates if those filters are applied or not */
static int * results = NULL; /**< this keeps the results of the applied filters */
static struct filter_item * filters = NULL;
@@ -76,7 +76,7 @@ void add_filter(char * criteria) {
while (criteria[cp]) {
int pos = exists_freed_filter(); // we check if there exists a freed filter
if (pos == -1) { // if not we alloc a new one
- filters = (struct filter_item *) scxrealloc((char *) filters, (howmany++ + 1) * (sizeof(struct filter_item)));
+ filters = (struct filter_item *) scxrealloc((char *) filters, (++howmany) * (sizeof(struct filter_item)));
pos = howmany-1;
}
@@ -221,9 +221,9 @@ int free_filters() {
if (filters[i].eval != NULL) {
scxfree((char *) filters[i].eval);
filters[i].eval = NULL;
- howmany--;
}
}
+ howmany = 0;
scxfree((char *) filters);
filters = NULL;
return 0;