diff mbox series

Consistent use of local `nlmsg_chain` variable `ipaddr_list_flush_or_save`

Message ID 8b50f492-2a3c-5f37-76d6-61f7fc692218@posteo.de (mailing list archive)
State New, archived
Delegated to: David Ahern
Headers show
Series Consistent use of local `nlmsg_chain` variable `ipaddr_list_flush_or_save` | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Max Kunzelmann Nov. 30, 2022, 10:02 p.m. UTC
During a brief code review we noticed a minor consistency issue 
regarding the variable naming. This patch changes the use of ainfo to be 
consistent with linfo.

The people mentioned in the commit message helped in the overall code 
review.

Kind regards,
Max
diff mbox series

Patch

From 553974345f40765ff6c96543b6de6ec3d8b6f871 Mon Sep 17 00:00:00 2001
From: Max Kunzelmann <maxdev@posteo.de>
Date: Wed, 23 Mar 2022 20:26:29 +0100
Subject: [PATCH] Consistent use of local `nlmsg_chain` variable
 `ipaddr_list_flush_or_save`

Reviewed-by: Benny Baumann <BenBE@geshi.org>
Reviewed-by: Robert Geislinger <github@crpykng.de>
---
 ip/ipaddress.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 5e833482..5630d52c 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -2107,7 +2107,7 @@  static int ip_addr_list(struct nlmsg_chain *ainfo)
 static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 {
 	struct nlmsg_chain linfo = { NULL, NULL};
-	struct nlmsg_chain _ainfo = { NULL, NULL}, *ainfo = &_ainfo;
+	struct nlmsg_chain ainfo = { NULL, NULL};
 	struct nlmsg_list *l;
 	char *filter_dev = NULL;
 	int no_link = 0;
@@ -2263,10 +2263,10 @@  static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 		if (filter.oneline)
 			no_link = 1;
 
-		if (ip_addr_list(ainfo) != 0)
+		if (ip_addr_list(&ainfo) != 0)
 			goto out;
 
-		ipaddr_filter(&linfo, ainfo);
+		ipaddr_filter(&linfo, &ainfo);
 	}
 
 	for (l = linfo.head; l; l = l->next) {
@@ -2278,7 +2278,7 @@  static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 		if (brief || !no_link)
 			res = print_linkinfo(n, stdout);
 		if (res >= 0 && filter.family != AF_PACKET)
-			print_selected_addrinfo(ifi, ainfo->head, stdout);
+			print_selected_addrinfo(ifi, ainfo.head, stdout);
 		if (res > 0 && !do_link && show_stats)
 			print_link_stats(stdout, n);
 		close_json_object();
@@ -2286,7 +2286,7 @@  static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
 	fflush(stdout);
 
 out:
-	free_nlmsg_chain(ainfo);
+	free_nlmsg_chain(&ainfo);
 	free_nlmsg_chain(&linfo);
 	delete_json_obj();
 	return 0;
-- 
2.38.1