]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: replace struct stmt_ops by type field in struct stmt
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 17 Mar 2025 22:19:49 +0000 (23:19 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 18 Mar 2025 15:37:47 +0000 (16:37 +0100)
commit3b92dc32e60e8c24c783af8d90a0928d71d520f4
treef7f8758241b4d2a0807b0e9c321bdf7d320b4fd6
parentf133180ee0c72f4a0de4a7acad8a9d8476914bd4
src: replace struct stmt_ops by type field in struct stmt

Shrink struct stmt in 8 bytes.

__stmt_ops_by_type() provides an operation for STMT_INVALID since this
is required by -o/--optimize.

There are many checks for stmt->ops->type, which is the most accessed
field, that can be trivially replaced.

BUG() uses statement type enum instead of name.

Similar to:

 68e76238749f ("src: expr: add and use expr_name helper").
 72931553828a ("src: expr: add expression etype")
 2cc91e6198e7 ("src: expr: add and use internal expr_ops helper")

Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
17 files changed:
include/ct.h
include/exthdr.h
include/meta.h
include/payload.h
include/statement.h
src/ct.c
src/evaluate.c
src/exthdr.c
src/json.c
src/meta.c
src/netlink_delinearize.c
src/netlink_linearize.c
src/optimize.c
src/parser_bison.y
src/payload.c
src/rule.c
src/statement.c