Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Justin Iurman <justin.iurman@uliege.be>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, dsahern@gmail.com, justin.iurman@uliege.be
Subject: [PATCH iproute2-next] ipioam6: use print_nl instead of print_null
Date: Wed, 11 Aug 2021 12:13:56 +0200	[thread overview]
Message-ID: <20210811101356.13958-1-justin.iurman@uliege.be> (raw)

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(-)

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)
-- 
2.25.1


             reply	other threads:[~2021-08-11 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 10:13 Justin Iurman [this message]
2021-08-11 18:28 ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811101356.13958-1-justin.iurman@uliege.be \
    --to=justin.iurman@uliege.be \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --subject='Re: [PATCH iproute2-next] ipioam6: use print_nl instead of print_null' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).