There is no need for dynamic callback mangling, so make all instances static const. Signed-off-by: Phil Sutter <phil@xxxxxx> --- iptables/nft-shared.h | 2 +- iptables/xtables-restore.c | 8 ++++---- iptables/xtables-translate.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h index 5c6641505f3db..b062f3e5792e3 100644 --- a/iptables/nft-shared.h +++ b/iptables/nft-shared.h @@ -262,7 +262,7 @@ struct nft_xt_restore_cb { void xtables_restore_parse(struct nft_handle *h, const struct nft_xt_restore_parse *p, - struct nft_xt_restore_cb *cb); + const struct nft_xt_restore_cb *cb); void nft_check_xt_legacy(int family, bool is_ipt_save); #endif diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c index 4652d631d2219..df8844208c273 100644 --- a/iptables/xtables-restore.c +++ b/iptables/xtables-restore.c @@ -70,7 +70,7 @@ static struct nftnl_chain_list *get_chain_list(struct nft_handle *h, return chain_list; } -struct nft_xt_restore_cb restore_cb = { +static const struct nft_xt_restore_cb restore_cb = { .chain_list = get_chain_list, .commit = nft_commit, .abort = nft_abort, @@ -87,7 +87,7 @@ static const struct xtc_ops xtc_ops = { void xtables_restore_parse(struct nft_handle *h, const struct nft_xt_restore_parse *p, - struct nft_xt_restore_cb *cb) + const struct nft_xt_restore_cb *cb) { const struct builtin_table *curtable = NULL; char buffer[10240]; @@ -432,7 +432,7 @@ static int ebt_table_flush(struct nft_handle *h, const char *table) return nft_table_flush(h, table); } -struct nft_xt_restore_cb ebt_restore_cb = { +static const struct nft_xt_restore_cb ebt_restore_cb = { .chain_list = get_chain_list, .commit = nft_bridge_commit, .table_new = nft_table_new, @@ -478,7 +478,7 @@ int xtables_eb_restore_main(int argc, char *argv[]) return 0; } -struct nft_xt_restore_cb arp_restore_cb = { +static const struct nft_xt_restore_cb arp_restore_cb = { .chain_list = get_chain_list, .commit = nft_commit, .table_new = nft_table_new, diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index 64e7667a253e7..43607901fc62b 100644 --- a/iptables/xtables-translate.c +++ b/iptables/xtables-translate.c @@ -413,7 +413,7 @@ static int dummy_compat_rev(const char *name, uint8_t rev, int opt) return 1; } -static struct nft_xt_restore_cb cb_xlate = { +static const struct nft_xt_restore_cb cb_xlate = { .table_new = xlate_table_new, .chain_set = xlate_chain_set, .chain_restore = xlate_chain_user_restore, -- 2.23.0