return rule ? CONTAINER_OF(rule, struct test_rule, cls_rule) : NULL;
}
+static void
+test_rule_destroy(struct test_rule *rule)
+{
+ if (rule) {
+ cls_rule_destroy(&rule->cls_rule);
+ free(rule);
+ }
+}
+
static struct test_rule *make_rule(int wc_fields, unsigned int priority,
int value_pat);
static void free_rule(struct test_rule *);
size_t i;
for (i = 0; i < tcls->n_rules; i++) {
- free(tcls->rules[i]);
+ test_rule_destroy(tcls->rules[i]);
}
free(tcls->rules);
}
for (i = 0; i < cls->n_rules; i++) {
struct test_rule *pos = cls->rules[i];
if (pos == rule) {
- free(pos);
+ test_rule_destroy(pos);
+
memmove(&cls->rules[i], &cls->rules[i + 1],
sizeof *cls->rules * (cls->n_rules - i - 1));
+
cls->n_rules--;
return;
}
minimask_destroy(&minimask);
}
+
+ minimask_destroy(&minicatchall);
}
static void
minimask_destroy(&minimask);
minimask_destroy(&minimask2);
}
+
+ minimask_destroy(&minicatchall);
}
\f
static const struct command commands[] = {