diff mbox series

[iproute2-next] ipioam6: use print_nl instead of print_null

Message ID 20210811101356.13958-1-justin.iurman@uliege.be (mailing list archive)
State Accepted
Delegated to: David Ahern
Headers show
Series [iproute2-next] ipioam6: use print_nl instead of print_null | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Justin Iurman Aug. 11, 2021, 10:13 a.m. UTC
This patch addresses Stephen's comment:

"""
> +        print_null(PRINT_ANY, "", "\n", NULL);

Use print_nl() since it handles the case of oneline output.
Plus in JSON the newline is meaningless.
"""

It also removes two useless print_null's.

Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
---
 ip/ipioam6.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

David Ahern Aug. 11, 2021, 6:28 p.m. UTC | #1
On 8/11/21 4:13 AM, Justin Iurman wrote:
> This patch addresses Stephen's comment:
> 
> """
>> +        print_null(PRINT_ANY, "", "\n", NULL);
> 
> Use print_nl() since it handles the case of oneline output.
> Plus in JSON the newline is meaningless.
> """
> 
> It also removes two useless print_null's.
> 
> Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
> ---
>  ip/ipioam6.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 


applied to iproute2-next
diff mbox series

Patch

diff --git a/ip/ipioam6.c b/ip/ipioam6.c
index 253d0b66..b63d7d5c 100644
--- a/ip/ipioam6.c
+++ b/ip/ipioam6.c
@@ -62,19 +62,15 @@  static void print_namespace(struct rtattr *attrs[])
 		print_uint(PRINT_ANY, "schema", " [schema %u]",
 			   rta_getattr_u32(attrs[IOAM6_ATTR_SC_ID]));
 
-	if (!attrs[IOAM6_ATTR_NS_DATA])
-		print_null(PRINT_ANY, "data", "", NULL);
-	else
+	if (attrs[IOAM6_ATTR_NS_DATA])
 		print_hex(PRINT_ANY, "data", ", data %#010x",
 			  rta_getattr_u32(attrs[IOAM6_ATTR_NS_DATA]));
 
-	if (!attrs[IOAM6_ATTR_NS_DATA_WIDE])
-		print_null(PRINT_ANY, "wide", "", NULL);
-	else
+	if (attrs[IOAM6_ATTR_NS_DATA_WIDE])
 		print_0xhex(PRINT_ANY, "wide", ", wide %#018lx",
 			    rta_getattr_u64(attrs[IOAM6_ATTR_NS_DATA_WIDE]));
 
-	print_null(PRINT_ANY, "", "\n", NULL);
+	print_nl();
 }
 
 static void print_schema(struct rtattr *attrs[])
@@ -97,7 +93,7 @@  static void print_schema(struct rtattr *attrs[])
 		print_hhu(PRINT_ANY, "", " %02x", data[i]);
 		i++;
 	}
-	print_null(PRINT_ANY, "", "\n", NULL);
+	print_nl();
 }
 
 static int process_msg(struct nlmsghdr *n, void *arg)