From c552570dc67a56614c1053b9ea2fb27cd6ce106b Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Sun, 15 Nov 2015 16:10:45 +0000 Subject: rule: move comment out of handle The comment does not belong to the handle, it belongs to the rule. Signed-off-by: Patrick McHardy --- src/rule.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index df4d1fb4..5d3cd841 100644 --- a/src/rule.c +++ b/src/rule.c @@ -32,7 +32,6 @@ void handle_free(struct handle *h) xfree(h->table); xfree(h->chain); xfree(h->set); - xfree(h->comment); } void handle_merge(struct handle *dst, const struct handle *src) @@ -49,8 +48,6 @@ void handle_merge(struct handle *dst, const struct handle *src) dst->handle = src->handle; if (dst->position == 0) dst->position = src->position; - if (dst->comment == NULL && src->comment != NULL) - dst->comment = xstrdup(src->comment); } static LIST_HEAD(table_list); @@ -378,6 +375,7 @@ void rule_free(struct rule *rule) { stmt_list_free(&rule->stmts); handle_free(&rule->handle); + xfree(rule->comment); xfree(rule); } @@ -390,8 +388,8 @@ void rule_print(const struct rule *rule) printf(" "); } - if (rule->handle.comment) - printf("comment \"%s\" ", rule->handle.comment); + if (rule->comment) + printf("comment \"%s\" ", rule->comment); if (handle_output > 0) printf("# handle %" PRIu64, rule->handle.handle); -- cgit v1.2.3