Browse Source

Remove PRINT_FIELD_INET4_ADDR

Reduce code duplication by removing PRINT_FIELD_INET4_ADDR
and using PRINT_FIELD_INET_ADDR instead.

* print_fields.h (PRINT_FIELD_INET4_ADDR): Remove.
* msghdr.c (print_cmsg_ip_pktinfo): Use PRINT_FIELD_INET_ADDR
instead of PRINT_FIELD_INET4_ADDR.
* net.c (print_mreq): Likewise.
* sockaddr.c (print_sockaddr_data_in): Likewise.
Dmitry V. Levin 11 months ago
parent
commit
b9a262af78
4 changed files with 5 additions and 9 deletions
  1. 2
    2
      msghdr.c
  2. 2
    2
      net.c
  3. 0
    4
      print_fields.h
  4. 1
    1
      sockaddr.c

+ 2
- 2
msghdr.c View File

@@ -107,8 +107,8 @@ print_cmsg_ip_pktinfo(struct tcb *tcp, const void *cmsg_data,
107 107
 	const struct in_pktinfo *info = cmsg_data;
108 108
 
109 109
 	PRINT_FIELD_IFINDEX("{", *info, ipi_ifindex);
110
-	PRINT_FIELD_INET4_ADDR(", ", *info, ipi_spec_dst);
111
-	PRINT_FIELD_INET4_ADDR(", ", *info, ipi_addr);
110
+	PRINT_FIELD_INET_ADDR(", ", *info, ipi_spec_dst, AF_INET);
111
+	PRINT_FIELD_INET_ADDR(", ", *info, ipi_addr, AF_INET);
112 112
 	tprints("}");
113 113
 }
114 114
 

+ 2
- 2
net.c View File

@@ -898,8 +898,8 @@ print_mreq(struct tcb *const tcp, const kernel_ulong_t addr,
898 898
 	if (len < (int) sizeof(mreq)) {
899 899
 		printaddr(addr);
900 900
 	} else if (!umove_or_printaddr(tcp, addr, &mreq)) {
901
-		PRINT_FIELD_INET4_ADDR("{", mreq, imr_multiaddr);
902
-		PRINT_FIELD_INET4_ADDR(", ", mreq, imr_interface);
901
+		PRINT_FIELD_INET_ADDR("{", mreq, imr_multiaddr, AF_INET);
902
+		PRINT_FIELD_INET_ADDR(", ", mreq, imr_interface, AF_INET);
903 903
 		tprints("}");
904 904
 	}
905 905
 }

+ 0
- 4
print_fields.h View File

@@ -159,10 +159,6 @@
159 159
 				sizeof((where_).field_), #field_);	\
160 160
 	} while (0)
161 161
 
162
-# define PRINT_FIELD_INET4_ADDR(prefix_, where_, field_)			\
163
-	STRACE_PRINTF("%s%s=inet_addr(\"%s\")", (prefix_), #field_,	\
164
-		      inet_ntoa((where_).field_))
165
-
166 162
 # define PRINT_FIELD_AX25_ADDR(prefix_, where_, field_)			\
167 163
 	do {								\
168 164
 		STRACE_PRINTF("%s%s=", (prefix_), #field_);		\

+ 1
- 1
sockaddr.c View File

@@ -146,7 +146,7 @@ print_sockaddr_data_in(const void *const buf, const int addrlen)
146 146
 	const struct sockaddr_in *const sa_in = buf;
147 147
 
148 148
 	PRINT_FIELD_NET_PORT("", *sa_in, sin_port);
149
-	PRINT_FIELD_INET4_ADDR(", ", *sa_in, sin_addr);
149
+	PRINT_FIELD_INET_ADDR(", ", *sa_in, sin_addr, AF_INET);
150 150
 }
151 151
 
152 152
 #define SIN6_MIN_LEN offsetof(struct sockaddr_in6, sin6_scope_id)

Loading…
Cancel
Save