parser_bison: include <nft.h> for base C environment to "parser_bison.y"
PATCH 1/2 parser_bison: include <nft.h> for base C environment to "parser_bison.y"
All our C sources should include <nft.h> as first. This prepares an environment of things that we expect to have available in all our C sources (and indirectly in our internal header files, because internal header files are always indirectly from a C source).
--- src/parser_bison.y | 1 + 1 file changed, 1 insertion(+)
src/parser_bison.y +1 -0
@@ -9,6 +9,7 @@ */ %{ +#include <nft.h> #include <ctype.h> #include <stddef.h>
Signature · 1 line
2.41.0
PATCH 2/2 include: include <stdlib.h> in <nft.h>
It provides malloc()/free(), which is so basic that we need it everywhere. Include via <nft.h>.
The ultimate purpose is to define more things in <nft.h>. While it has not corresponding C sources, <nft.h> can contain macros and static inline functions, and is a good place for things that we shall have everywhere. Since <stdlib.h> provides malloc()/free() and size_t, that is a very basic dependency, that will be needed for that.
--- include/nft.h | 1 + include/utils.h | 1 - src/cli.c | 1 - src/cmd.c | 1 - src/ct.c | 1 - src/datatype.c | 1 - src/erec.c | 1 - src/evaluate.c | 1 - src/expression.c | 1 - src/exthdr.c | 1 - src/gmputil.c | 1 - src/iface.c | 1 - src/libnftables.c | 1 - src/main.c | 1 - src/meta.c | 1 - src/mini-gmp.c | 1 - src/misspell.c | 1 - src/mnl.c | 1 - src/monitor.c | 1 - src/netlink.c | 1 - src/netlink_delinearize.c | 1 - src/nfnl_osf.c | 1 - src/owner.c | 1 - src/payload.c | 1 - src/proto.c | 1 - src/rt.c | 1 - src/rule.c | 1 - src/segtree.c | 1 - src/statement.c | 1 - src/tcpopt.c | 1 - src/utils.c | 1 - src/xt.c | 1 - 32 files changed, 1 insertion(+), 31 deletions(-)
include/nft.h +1 -0
@@ -6,5 +6,6 @@#include <stdbool.h> #include <stdint.h> +#include <stdlib.h> #endif /* NFTABLES_NFT_H */
include/utils.h +0 -1
@@ -3,7 +3,6 @@#include <asm/byteorder.h> #include <stdarg.h> -#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <assert.h>
src/cli.c +0 -1
@@ -14,7 +14,6 @@#include <nft.h> -#include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <unistd.h>
src/cmd.c +0 -1
@@ -15,7 +15,6 @@#include <utils.h> #include <iface.h> #include <errno.h> -#include <stdlib.h> #include <cache.h> #include <string.h>
src/ct.c +0 -1
@@ -13,7 +13,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <inttypes.h> #include <string.h>
src/datatype.c +0 -1
@@ -10,7 +10,6 @@#include <nft.h> -#include <stdlib.h> #include <string.h> #include <inttypes.h> #include <ctype.h> /* isdigit */
src/erec.c +0 -1
@@ -13,7 +13,6 @@#include <stdio.h> #include <string.h> #include <stdarg.h> -#include <stdlib.h> #include <netlink.h> #include <gmputil.h>
src/evaluate.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <arpa/inet.h>
src/expression.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <limits.h>
src/exthdr.c +0 -1
@@ -13,7 +13,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <netinet/in.h>
src/gmputil.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdarg.h> #include <stdio.h> #include <unistd.h>
src/iface.c +0 -1
@@ -9,7 +9,6 @@#include <nft.h> #include <stdio.h> -#include <stdlib.h> #include <net/if.h> #include <time.h> #include <string.h>
src/libnftables.c +0 -1
@@ -16,7 +16,6 @@#include <iface.h> #include <cmd.h> #include <errno.h> -#include <stdlib.h> #include <string.h> static int nft_netlink(struct nft_ctx *nft,
src/main.c +0 -1
@@ -10,7 +10,6 @@#include <nft.h> -#include <stdlib.h> #include <stddef.h> #include <unistd.h> #include <stdio.h>
src/meta.c +0 -1
@@ -15,7 +15,6 @@#include <errno.h> #include <limits.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <net/if.h>
src/mini-gmp.c +0 -1
@@ -47,7 +47,6 @@ see https://www.gnu.org/licenses/. */#include <ctype.h> #include <limits.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include "mini-gmp.h"
src/misspell.c +0 -1
@@ -8,7 +8,6 @@#include <nft.h> -#include <stdlib.h> #include <string.h> #include <limits.h> #include <utils.h>
src/mnl.c +0 -1
@@ -35,7 +35,6 @@#include <arpa/inet.h> #include <fcntl.h> #include <errno.h> -#include <stdlib.h> #include <utils.h> #include <nftables.h> #include <linux/netfilter.h>
src/monitor.c +0 -1
@@ -14,7 +14,6 @@#include <libmnl/libmnl.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <stdlib.h> #include <inttypes.h> #include <libnftnl/table.h>
src/netlink.c +0 -1
@@ -16,7 +16,6 @@#include <libmnl/libmnl.h> #include <netinet/in.h> #include <arpa/inet.h> -#include <stdlib.h> #include <inttypes.h> #include <libnftnl/table.h>
src/netlink_delinearize.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> -#include <stdlib.h> #include <string.h> #include <limits.h> #include <linux/netfilter/nf_tables.h>
src/nfnl_osf.c +0 -1
@@ -25,7 +25,6 @@#include <ctype.h> #include <errno.h> -#include <stdlib.h> #include <string.h> #include <time.h>
src/owner.c +0 -1
@@ -10,7 +10,6 @@#include <stdio.h> #include <unistd.h> -#include <stdlib.h> #include <sys/time.h> #include <time.h> #include <inttypes.h>
src/payload.c +0 -1
@@ -13,7 +13,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <net/if_arp.h>
src/proto.c +0 -1
@@ -12,7 +12,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <string.h> #include <net/if_arp.h> #include <arpa/inet.h>
src/rt.c +0 -1
@@ -12,7 +12,6 @@#include <errno.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <arpa/inet.h>
src/rule.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <inttypes.h>
src/segtree.c +0 -1
@@ -10,7 +10,6 @@#include <nft.h> -#include <stdlib.h> #include <string.h> #include <inttypes.h> #include <arpa/inet.h>
src/statement.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <inttypes.h> #include <string.h>
src/tcpopt.c +0 -1
@@ -1,7 +1,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <netinet/in.h>
src/utils.c +0 -1
@@ -11,7 +11,6 @@#include <nft.h> #include <stddef.h> -#include <stdlib.h> #include <stdarg.h> #include <stdio.h> #include <unistd.h>
src/xt.c +0 -1
@@ -9,7 +9,6 @@#include <nft.h> -#include <stdlib.h> #include <time.h> #include <string.h> #include <net/if.h>
Signature · 1 line
2.41.0
Pablo Neira Ayuso
maintainerRe: [PATCH nft 2/2] include: include <stdlib.h> in <nft.h>
Quoted 8 lines · Thomas Haller
It provides malloc()/free(), which is so basic that we need it everywhere. Include via <
nft.h>.The ultimate purpose is to define more things in <
nft.h>. While it has not corresponding C sources, <nft.h> can contain macros and static inline functions, and is a good place for things that we shall have everywhere. Since <stdlib.h> provides malloc()/free() andsize_t, that is a very basic dependency, that will be needed for that.
Also applied, thanks
Quoted 4 lines · Thomas Haller
All our C sources should include <
nft.h> as first. This prepares an environment of things that we expect to have available in all our C sources (and indirectly in our internal header files, because internal header files are always indirectly from a C source).
Applied, thanks