]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: silence compiler warnings
authorFlorian Westphal <fw@strlen.de>
Sat, 15 Jan 2022 19:00:49 +0000 (20:00 +0100)
committerFlorian Westphal <fw@strlen.de>
Sat, 15 Jan 2022 19:16:32 +0000 (20:16 +0100)
cache.c:504:22: warning: ‘chain’ may be used uninitialized in this function [-Wmaybe-uninitialized]
cache.c:504:22: warning: ‘table’ may be used uninitialized in this function [-Wmaybe-uninitialized]
erec.c:128:16: warning: ‘line’ may be used uninitialized in this function [-Wmaybe-uninitialized]
optimize.c:524:9: warning: ‘line’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Fixes: 8ad4056e9182 ("erec: expose print_location() and line_location()")
Fixes: afbd102211dc ("src: do not use the nft_cache_filter object from mnl.c")
Fixes: fb298877ece2 ("src: add ruleset optimization infrastructure")
Signed-off-by: Florian Westphal <fw@strlen.de>
src/cache.c
src/erec.c
src/optimize.c

index 630d6ae1307c2f8761fa65819873ff293594ec5d..8e8387f91955aefc5ea0836b6d36c670d09caed9 100644 (file)
@@ -493,8 +493,8 @@ static int rule_cache_dump(struct netlink_ctx *ctx, const struct handle *h,
                           const struct nft_cache_filter *filter)
 {
        struct nftnl_rule_list *rule_cache;
-       const char *table;
-       const char *chain;
+       const char *table = NULL;
+       const char *chain = NULL;
 
        if (filter) {
                table = filter->list.table;
index 32fb079fa8b482af480b663b0028ce0a38f29210..a4b93fb0d0d61a5794201d5f9b6bbb47291897e5 100644 (file)
@@ -111,7 +111,7 @@ void print_location(FILE *f, const struct input_descriptor *indesc,
 const char *line_location(const struct input_descriptor *indesc,
                          const struct location *loc, char *buf, size_t bufsiz)
 {
-       const char *line;
+       const char *line = NULL;
        FILE *f;
 
        f = fopen(indesc->name, "r");
index 76872caa841413af28b3d17d8dd4a304bc91e216..b5fb2c4179d074f52a11afcc235f43d768957a0e 100644 (file)
@@ -496,7 +496,7 @@ static void rule_optimize_print(struct output_ctx *octx,
 {
        const struct location *loc = &rule->location;
        const struct input_descriptor *indesc = loc->indesc;
-       const char *line;
+       const char *line = "";
        char buf[1024];
 
        switch (indesc->type) {