[PATCH nft 3/8] src: use "%zx" format instead of "%Zx"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"%zu" is C99. On the other hand, `man printf` comments about "Z":

  A nonstandard synonym for z that predates the appearance of z.  Do not use in code.

This fixes a compiler warning with clang:

    datatype.c:299:26: error: invalid conversion specifier 'Z' [-Werror,-Wformat-invalid-specifier]
            nft_gmp_print(octx, "0x%Zx [invalid type]", expr->value);
                                   ~^

Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx>
---
 src/datatype.c  |  6 +++---
 src/intervals.c | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/datatype.c b/src/datatype.c
index dd6a5fbf5df8..a91b9cb793d5 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -296,7 +296,7 @@ void symbol_table_print(const struct symbol_table *tbl,
 
 static void invalid_type_print(const struct expr *expr, struct output_ctx *octx)
 {
-	nft_gmp_print(octx, "0x%Zx [invalid type]", expr->value);
+	nft_gmp_print(octx, "0x%zx [invalid type]", expr->value);
 }
 
 const struct datatype invalid_type = {
@@ -436,7 +436,7 @@ const struct datatype bitmask_type = {
 	.type		= TYPE_BITMASK,
 	.name		= "bitmask",
 	.desc		= "bitmask",
-	.basefmt	= "0x%Zx",
+	.basefmt	= "0x%zx",
 	.basetype	= &integer_type,
 };
 
@@ -486,7 +486,7 @@ const struct datatype integer_type = {
 
 static void xinteger_type_print(const struct expr *expr, struct output_ctx *octx)
 {
-	nft_gmp_print(octx, "0x%Zx", expr->value);
+	nft_gmp_print(octx, "0x%zx", expr->value);
 }
 
 /* Alias of integer_type to print raw payload expressions in hexadecimal. */
diff --git a/src/intervals.c b/src/intervals.c
index 85de0199c373..a24f2ca69cb4 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -70,7 +70,7 @@ struct set_automerge_ctx {
 static void purge_elem(struct set_automerge_ctx *ctx, struct expr *i)
 {
 	if (ctx->debug_mask & NFT_DEBUG_SEGTREE) {
-		pr_gmp_debug("remove: [%Zx-%Zx]\n",
+		pr_gmp_debug("remove: [%zx-%zx]\n",
 			     i->key->left->value,
 			     i->key->right->value);
 	}
@@ -255,7 +255,7 @@ int set_automerge(struct list_head *msgs, struct cmd *cmd, struct set *set,
 			list_move_tail(&i->list, &existing_set->init->expressions);
 		} else if (existing_set) {
 			if (debug_mask & NFT_DEBUG_SEGTREE) {
-				pr_gmp_debug("add: [%Zx-%Zx]\n",
+				pr_gmp_debug("add: [%zx-%zx]\n",
 					     i->key->left->value, i->key->right->value);
 			}
 			clone = expr_clone(i);
@@ -509,13 +509,13 @@ int set_delete(struct list_head *msgs, struct cmd *cmd, struct set *set,
 
 	if (debug_mask & NFT_DEBUG_SEGTREE) {
 		list_for_each_entry(i, &init->expressions, list)
-			pr_gmp_debug("remove: [%Zx-%Zx]\n",
+			pr_gmp_debug("remove: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 		list_for_each_entry(i, &add->expressions, list)
-			pr_gmp_debug("add: [%Zx-%Zx]\n",
+			pr_gmp_debug("add: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 		list_for_each_entry(i, &existing_set->init->expressions, list)
-			pr_gmp_debug("existing: [%Zx-%Zx]\n",
+			pr_gmp_debug("existing: [%zx-%zx]\n",
 				     i->key->left->value, i->key->right->value);
 	}
 
-- 
2.41.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux